It’s the middle of the night, and you can’t sleep. Time to choose your own adventure:

1. Toss and turn all night, angsting about the sleep you aren’t getting.

2. Make a steaming cup of something warm and try to sip yourself to sleep.

3. Pop the Xanax you got for the last time you flew cross-country and thank modern medicine for all it’s good for.

If you’re anything like us, when you go against your doctor’s orders (“Only take one for anxiety before a flight”), you feel uneasy. But you rationalize: One’s not going to kill me.

No, it’s probably not, says Margot Farber, director of the Drug Information Service and clinical assistant professor in pharmacy at the University of Michigan. But while it might not be a life-threatening choice, it’s definitely not the best option for most people today.

Xanax belongs to a class of drugs called benzodiazepines (nicknamed benzos), along with Valium, Ativan, and Klonopin. Doctors and psychiatrists usually prescribe them for anxiety.

They mimic your brain’s GABA (gamma-aminobutyric acid) neurotransmitter and provide a sedating effect, Farber says. This basically calms you down and can make you sleepy, which is why some people reach for Xanax at night.

But that’s kind of a roundabout way of doing things. In comparison, Farber says, the “Z drugs” (as in catching some Zzz’s), or non-benzodiazepines specifically made for sleep, don’t mimic GABA but activate the receptor that GABA would normally trigger.

Think Lunesta, Sonata, or Ambien. Same endgame — glorious sleep — but they’re faster-acting and without many of the side effects.

Side effects of benzodiazepines are nothing to mess around with. They range from temporary amnesia to grogginess to reduced motor function.

Some others include:

  • blurred vision
  • dizziness
  • diarrhea
  • dry mouth
  • headaches
  • nausea
  • loss of libido
  • stuffy nose
  • sweating
  • vomiting

Farber says people taking benzodiazepines regularly adapt to the dosage, so they don’t experience “the hangover effect” quite as strongly.

But if you’re prescribed Xanax for only occasional use and you pop a one-off in the middle of the night, you’ll likely feel the effects in full force.

Plus, Xanax was made to treat anxiety. Say you’re a nervous flier: When you take a benzo before boarding, the medicine goes up against the chemicals surging in your body.

This counteracts some of the drug’s effect, says Joseph Ojile, MD, medical director and chief executive officer of the Clayton Sleep Institute.

So, if you take it when you’re actually calm and relaxed — for instance, about to go to bed — there’s none of that counteraction. The grogginess and amnesia may hit you more severely.

Side effects can persist for 8 to 12 hours, meaning you may actually feel more tired in the morning than you normally would (irony at its worst).

So if you take the Xanax at 2 a.m. and wake up at 7 a.m., you’ve still got 7 more hours’ worth of those side effects. This could mean bad news for getting to work on time.

Basically, yes, there are better options — namely, sleep medications, reducing your stress, and setting up your bedroom for sleep success (sorry, laptop).

But if sleeplessness hits and you have a Xanax left over, Ojile says it’s fine to take one once or twice a week, as long as you haven’t been drinking.

Other harmful interactions can occur from:

  • anesthetics
  • antacids
  • anticonvulsants
  • antidepressants
  • anxiolytics
  • barbiturates
  • birth control
  • narcotic analgesics
  • sedative antihistamines

If you’re not taking any of those, try half your normal dose first. The risks are dose-related, so if you take less medicine, you run a lower risk of that dreaded hangover.

If you need to take Xanax, try to stick to just once or twice a week. Any more and you increase your chances of building a tolerance, says John Mendelson, MD, a clinical professor of medicine at UCSF and an expert in addiction and clinical psychopharmacology.

“Tolerance happens pretty easily — just taking it [every night] for a week or two, a very short period of time. Then once you’re tolerant, the drug can have less of an effect,” Mendelson says.

In that same vein, you’ll also become dependent, meaning you’ll need it to fall asleep. You may even go through withdrawal symptoms, like rebound anxiety or insomnia, when you try to stop, Farber says. Long-term use of benzos is no bueno.

Have a chat with your doctor if you experience any of these symptoms:

  • changes in mood
  • chest pain
  • confusion
  • depression
  • hallucinations
  • irregular heartbeat
  • memory loss
  • suicidal thoughts
  • seizures
  • tremors

Also, if you start taking Xanax regularly, it could be life-threatening to suddenly stop taking the drug. It’s very important to work with a physician you trust to taper down your dose.

One Xanax (or even better, half of one) is fine to take once in a while, if you can’t get to sleep and you have a leftover on hand. But don’t expect to be firing on all cylinders the next morning, and keep in mind that there are way better options.

Upping your sleep hygiene can help, as can meditation and CBD oil. Even prescription and over-the-counter medicines can make it possible for you to go to bed relaxed and catch plenty of Zzz’s without turning into a zombie the next morning. Sweet dreams.