prescription pills
In this Article

Many people with chronic insomnia turn to medications for relief. You have many options to choose from, including prescription and over-the-counter drugs.

It's important to use these medications wisely, and under a doctor's care. They're not right for everyone. They may have side effects, and some can be addictive if you don't use them properly. Most insomnia medications aren't meant to be used for a long time.

 But in some cases, they can be a good short-term solution to help you get some rest.   

See Your Doctor First

When you have insomnia, your first step should be to make an appointment with your doctor. They’ll ask about your sleep habits and may run tests to find out if another health issue is interfering with your sleep. They may advise you on good sleep habits, or refer you to another doctor to treat any medical conditions that may be contributing to your insomnia.

Before trying medicine, sleep experts suggest that you start with cognitive behavioral therapy for insomnia (CBT-I). There’s less chance of side effects or dependency. And you’ll learn strategies that can be helpful for longer.

CBT-I helps you spot thoughts and behaviors that make insomnia worse, and swap them for ones that encourage better sleep. It may teach you better sleep habits, relaxation techniques, and more. 

“Research shows that CBT for insomnia is as effective as sleep medication in the short term and more effective in the long term, so you’re getting an overall more effective treatment that can be more sustained,” says  Annie Miller, a behavioral sleep medicine therapist at DC Metro Sleep and Psychotherapy in Bethesda, MD.

But it takes time and effort for CBT-I to work. If insomnia is badly disrupting your daily life, or if you're losing sleep because you're going through a sad or stressful time, your doctor may decide that medication will help.  

Prescription Sleep Medicines

In choosing a sleep aid, your doctor will consider your health, age, other medical conditions, and other medications you're taking. You may have to try more than one drug before finding one that works for you.

Your doctor should discuss your options before writing a prescription. A generic version could save you money. If you have health insurance, find out whether your provider covers insomnia medications and if there are restrictions on them.

Prescription drugs for insomnia include:

  • Benzodiazepines: This older class of drugs makes you drowsy by slowing your central nervous system. Although doctors still prescribe it, they usually start with newer drugs first. That's because benzodiazepines have the potential to be addictive, and you can quickly build a tolerance to them. 
  • Z Drugs: These newer medication (dubbed “Z” drugs because the names of the drugs contain this letter) work in a similar way to benzodiazepines. The major differences: fewer side effects, and you’re less likely to become dependent. But the FDA warns that, in rare cases, people taking these drugs may sleepwalk or perform other "complex sleep behaviors" while not fully awake. 
  • Orexin receptor antagonists: This newer class of drug helps you fall asleep by lowering the amount of orexin your brain makes. Orexin is a chemical "messenger" that helps keep you awake.
  • Antidepressants: One side effect of antidepressant drugs is they can make you feel sleepy. But experts generally don’t suggest you take them for this purpose. The FDA has  approved only one antidepressant for insomnia, called doxepin.
  • Melatonin receptor agonist: This prescription drug, ramelteon, imitates the hormone melatonin. Your body makes melatonin to help regulate your sleep-wake cycle. It doesn't work for sleep maintenance insomnia, the kind where you have trouble staying asleep.

Over-the-Counter Sleep Aids

Like prescription drugs, over-the-counter sleep aids can interact with other medications. They may not be right for people with certain health conditions. So always check with your doctor before using one.

Common OTC sleep aids include:

  • Antihistamines: Most OTC sleep aids have an antihistamine as their main ingredient. Antihistamines make you sleepy because they work against histamine, a chemical made by your nervous system that plays a role in wakefulness. It's easy to build a tolerance to antihistamines.
  • Melatonin: This hormone, sold as a dietary supplement in the U.S., is considered safe. Some research shows it might slightly cut the time it takes you to get to sleep.  But there’s no clear proof it works well for insomnia. “The problem with melatonin for insomnia is, your brain starts to make an association of, ‘I need this thing in order to sleep.’ Then you’re going to have a hard time sleeping without it,” Miller says.

Keep in mind that the FDA regulates both over-the-counter drugs and supplements less strictly  than prescription medications.

What Are the Side Effects of Sleep Aids?

Whether they're over-the-counter or prescription, sleep aids can have unwanted side effects. Some of them include:

  • Feeling drowsy the next day
  • Dizziness
  • Headache
  • Diarrhea, nausea, or other digestive problems
  • Memory and performance issues
  • Sleepwalking, sleep driving, and sleep cooking/eating (especially with “Z” drugs)
  • Allergic reactions

Safest Ways to Take Sleep Medication

Before you start any sleep medication, make sure you know how to use it safely:

  • Tell your doctor if you’re taking other medications or have health issues like high blood pressure or a liver condition
  • Tell your doctor if you're pregnant or trying to get pregnant
  • Read your medication’s package insert closely
  • Only take the dose your doctor prescribes
  • Don't drink alcohol while taking it
  • Don't take it until right before bedtime
  • Set aside plenty of time for sleep after you take it (4-8 hours depending on the medication)
  • When trying a new medication, take your first dose on a night when you can stay home the next morning
  • Don't drive while taking sleep aids
  • Call your doctor or pharmacist if you have any side effects
  • Talk to your doctor before you stop taking the medication

It's important to be consistent with prescription sleep medication. If you skip a night or two, “it can be confusing for the brain,” Miller says. “We want there to be a consistent message for the brain so it isn’t only depending on medication at certain times.”

Who Shouldn't Take Sleep Medications?

Prescription sleeping pills may not be safe if you’re pregnant or breastfeeding. Ask your doctor even before taking an OTC sleep aid.

Use caution if you have:

  • Kidney disease
  • Low blood pressure
  • Heart rhythm issues
  • Seizures

Not all sleep medicines are safe for people with those conditions, but your doctor may be able to prescribe one you can use.

Older people, particularly those over age 75, should be especially careful. Sleep aids may affect you more than they do younger adults, and they stay in your body longer. They can lead to confusion and memory troubles, which raise your risk of accidents and injuries. Even nonprescription sleep aids may have worse side effects for older people.

If you have a history of substance abuse, nondrug treatments for insomnia (such as therapy) are safest. Your doctor may give you the OK to use certain medications, like antidepressants or melatonin receptor agonists.

Medication Is Not a Long-Term Solution

While sleeping pills may give you short-term relief from your insomnia, they don’t address its root cause, says one sleep expert.

“The treatment for insomnia is a reconstruction, a cognitive reordering of the way you think about sleep, not drugging yourself every night,” says Chris Winter, MD, a neurologist and sleep specialist in Charlottesville, VA.

In some cases, he thinks sleep aids can make insomnia worse. “They’re not helping the problem, they’re obscuring it,” he says.

Therapy, alone or together with medication, could help you get to the bottom of what’s keeping you awake.

© 2021 WebMD, LLC. All rights reserved.

Show Sources

Photo Credit: Charles Wollertz


Annie Miller, behavioral sleep medicine therapist, DC Metro Sleep and Psychotherapy, Bethesda, MD.

Chris Winter, MD, neurologist and sleep specialist, Charlottesville Neurology and Sleep Medicine, Charlottesville, VA.

Mayo Clinic: “Insomnia treatment: Cognitive behavioral therapy instead of sleeping pills,” “Prescription sleeping pills: What's right for you?” "Sleep aids: Understand over-the-counter options."

FDA: “Taking Z-drugs for Insomnia? Know the Risks.”

American Academy of Sleep Medicine Sleep Education: “Ten Safety Tips for Taking Sleeping Pills for Insomnia.”

Sleep Foundation: “Compare Sleep Aids,” “How To Use Sleep Medications Safely.”

Choosing Wisely: “Insomnia and Anxiety in Older People.”

Substance Abuse and Mental Health Services Administration: "Treating Sleep Problems of People in Recovery From Substance Use Disorders."