Skip to main content
Insomnia

What Are the Best Sleep Medications for Insomnia?

Christina Aungst, PharmD, MWCKatie E. Golden, MD
Written by Christina Aungst, PharmD, MWC | Reviewed by Katie E. Golden, MD
Updated on August 20, 2026

Key takeaways:

  • There are many different types of prescription and over-the-counter sleep medications. Some are better at helping you fall asleep, while others can help you stay asleep.

  • The best sleep medication for you depends on the type of sleep troubles you have, your age, and your other medical conditions and medications.

  • Sleep medications come with serious risks and are meant for short-term use. Taking them long term may lead to dependence and other health problems in some cases.

  • Side effects of sleep medications include memory problems, falls, and even death. So it’s important to understand the risks before you start taking one.

Up to 40% of U.S. adults experience insomnia. And sleeplessness affects more than how you feel or function from day to day. It can increase your risk of long-term health conditions, like heart disease and dementia.

If you’ve tried insomnia treatments like lifestyle changes and cognitive behavioral therapy without much improvement, you might be considering sleep medication. But there are some things to keep in mind before you start. Let’s go through all your options, along with their side effects and risks, so you can choose the best option for you.

Which prescription sleep medications are best for insomnia?

The following categories are the most common prescription sleep medications to help treat insomnia or sleeplessness. It’s important to work closely with a healthcare professional to choose the best one for you. This is because all the medications below:

  • Have their own specific and serious risks and aren’t safe for everyone.

  • Should be taken for the shortest amount of time possible. Your healthcare team can help monitor how you respond to treatment and how long it’s safe for you to take the medication.

  • Work in slightly different ways, depending on the type of sleep problems you have. For example, most sleep medications help you fall asleep rather than stay asleep.

“Z-drugs” 

The term “z-drugs” refers to a group of medications that have a sedative effect and are commonly used for sleeplessness. They aren’t intended for daily, long-term use. Common examples include zolpidem (Ambien) and zaleplon. They can be taken as needed and usually start working within an hour. Some can last for about 8 hours.

For people who wake up in the middle of the night, another option is sublingual zolpidem. It’s a low dose of zolpidem that dissolves quickly under your tongue. Its effects only last for a few hours. It’s meant for people who wake up halfway through the night and only have about 4 hours left until they need to get up.

Longer-acting z-drugs are sometimes prescribed to help people who wake up too early. This is because they last longer in the body. But this also means they may cause more of a hangover sensation the next morning, including drowsiness, grogginess, or a headache. Examples include zolpidem ER (Ambien CR) and eszopiclone (Lunesta).

Side effects: These medications are associated with serious side effects and risks that you should be aware of before taking them:

  • They can be habit forming and have a risk of misuse.

  • Long-term use is linked to an increased risk of death.

  • Some research has linked them to an increased risk of dementia, but the research is still inconclusive.

  • Some people experience hallucinations and vivid nightmares while taking them.

  • While the drug is active in your system, you may perform dangerous activities while asleep, like cooking or driving.

Benzodiazepines

Benzodiazepines are a well-known treatment for anxiety. Their sedative effect can also help people with sleeplessness. But like z-drugs, they aren’t intended for regular, long-term use. 

Some shorter-acting benzodiazepines, such as estazolam or triazolam (Halcion), are approved by the FDA to treat insomnia. Those that are approved for anxiety, such as clonazepam (Klonopin), might be prescribed when both anxiety and insomnia are issues.

Examples of benzodiazepines that are longer-acting include flurazepam and temazepam (Restoril).

Side effects: The side effects of benzodiazepines are similar to those of z-drugs:

Ramelteon (Rozerem)

Ramelteon (Rozerem) is a melatonin receptor agonist. It works in the same area of your body as melatonin, the body’s natural sleep hormone, to help promote sleep. It works in a similar way to melatonin. This means it’s better at helping you fall asleep than helping you stay asleep.

Side effects: Ramelteon’s side effects are generally mild, and it isn’t habit forming. Common side effects include dizziness, nausea, and next-day drowsiness. Very rarely, people taking ramelteon have reported worsening depression and thoughts of suicide.

If you or someone you know is having thoughts of suicide, you’re not alone, and help is available. Call the National Suicide Prevention Lifeline at 988, or text “HOME” to 741-741 to reach the Crisis Text Line.

Trazodone

Trazodone is an antidepressant. But because it causes drowsiness as a side effect, some healthcare professionals prescribe it off-label at a low dose to help people fall asleep more easily.

Side effects: Common trazodone side effects include daytime sleepiness, dry mouth, and dizziness when standing up too quickly. It isn’t habit forming. There’s also a rare but very serious risk of a painful, prolonged erection (priapism) in men who take trazodone.

Doxepin (Silenor)

Doxepin (Silenor) is a tricyclic antidepressant that’s FDA approved to treat insomnia. When used for sleeplessness, it’s recommended to take smaller dosages of 3 mg to 6 mg. Larger dosages of 10 mg or more are approved to treat depression and anxiety.

Side effects: Doxepin isn’t habit forming, but it does have a number of side effects to consider:

  • Dry mouth

  • Constipation

  • Dizziness

  • Increased blood pressure or heart rate

  • Increased risk of falls, especially in older adults

Orexin receptor antagonists

Orexin receptor antagonists (ORAs) are a newer class of sleep medications. They work by blocking orexin, a natural chemical that tells your body it’s time to wake up. ORAs include suvorexant (Belsomra) and lemborexant (Dayvigo).

Side effects: Clinical studies haven’t found ORAs to be habit forming like other sleep medications. Some people may engage in dangerous activities while sleeping, like walking, driving, or eating. If any of these happen to you, talk to your prescriber about whether an ORA is the best match for your insomnia.

Featuring Stacia Woodcock, PharmDReviewed by Sanjai Sinha, MD | November 5, 2025

Over-the-counter medications for treating insomnia

Over-the-counter (OTC) sleep aids are plentiful. But just like prescription sleep medications, it’s important to consider them with caution. The American Academy of Sleep Medicine recommends that people avoid them when treating chronic insomnia. But when used sparingly, OTC sleep aids may be an alternative if you don’t want to take prescription sleep medications.

Most OTC medications for insomnia contain one of the ingredients listed below.

Diphenhydramine

Diphenhydramine, the active ingredient in Benadryl, is an antihistamine that’s found in OTC sleep aids under different names, such as ZzzQuil. Most people who take diphenhydramine get very drowsy within an hour of taking it. It’s not recommended to take diphenhydramine for sleep for longer than 14 days in a row.

Side effects: Diphenhydramine can cause side effects, such as dizziness, dry mouth, and memory issues. Some research suggests that it’s linked to an increased risk of dementia. If you’re over 65 years of age, you should avoid diphenhydramine because you may have a greater risk of serious side effects, including falls.

Doxylamine

Doxylamine, the active ingredient in most Unisom products, is also an antihistamine. Compared to diphenhydramine, it stays in your body longer. As with other OTC options, you shouldn’t take it regularly.

Side effects: Doxylamine has similar side effects to diphenhydramine. It’s also not recommended if you’re over 65 years old.

Melatonin

Melatonin is the hormone that your body produces as the sun goes down. It helps you fall asleep. Many people think of OTC melatonin supplements as a natural way to help with sleeplessness. While it doesn’t carry as many risks as other sleep medications, researchers are still studying whether it’s safe to take every night.

Side effects: Since melatonin is considered a supplement, it isn’t regulated like prescription sleep medications. This means there’s less information about its possible side effects and long-term safety. And there have been reports of people taking too much because some bottles contain more melatonin than the label advertises.

Most people seem to tolerate melatonin well. Still, it can cause next-day drowsiness, nausea, and headaches. Some people also experience vivid dreams on nights when they take it.

Natural sleep medications

In addition to prescription sleep medications and OTC sleep aids, some people prefer supplements as a more natural remedy for sleeplessness. But keep in mind that natural doesn’t necessarily mean they’re safer. Like melatonin, these products aren’t regulated like prescription medications. Before you take a sleep supplement, it’s important to understand its potential risks and medication interactions.

Examples of sleep supplements that have some research behind them include:

  • Magnesium: Some studies suggest that magnesium can help you fall asleep and stay asleep. But it can have some side effects, like nausea and diarrhea. If you have kidney problems, you may need to avoid magnesium.

  • Tryptophan and 5-hydroxytryptophan (5-HTP): Tryptophan is an amino acid that’s broken down into 5-HTP. The body uses 5-HTP to make serotonin and melatonin. Some people take these supplements to help with both sleep and mood.

  • L-theanine: L-theanine is an amino acid found naturally in tea leaves. As a supplement, it’s generally well tolerated and may cause fewer side effects than others on this list.

  • Cannabidiol (CBD): CBD is one of the active ingredients in cannabis. It doesn’t cause a high like other active ingredients in the plant. But some research suggests it can help with relaxation and sleep.

  • Chamomile: For centuries, people have been drinking chamomile tea to help with sleep. Even though modern research is lacking, many people report that it helps them sleep. It’s less clear whether its active ingredient, apigenin, is helpful as a supplement.

When should you take sleep medications?

Take your prescribed medication right before you plan to go to bed. Many people feel its effects within an hour of their dose.

Any of these medications can cause a “hangover” effect the next morning. You might feel groggy or drowsy or have a headache. This is especially true if you wake up before the medication has fully worn off. To lower this risk, make sure you have at least 7 to 8 hours available for sleep after taking your medication. One exception is sublingual zolpidem, which you can take if you have at least 4 hours left to sleep.

Risks with sleep medications

We covered some of the risks of each sleep medication above. But there are a few general precautions to keep in mind, no matter which medication you take.

They can be habit forming

If you take sleep medications every night, your body and mind can become dependent on them to sleep. And the longer you take them, the harder it might be to stop. It can be very difficult to stop taking them if you’ve been taking them for a while.

Older adults should be extra careful

Sleep medications can be particularly dangerous for older adults. Older adults may have more intense side effects from these medications and may be more likely to become physically dependent on them. Some side effects, like falls, can also have bigger consequences for older adults.

Don’t mix them with other medications or alcohol

If you drink alcohol or take other medications that cause drowsiness, like opioids or muscle relaxers, you should avoid taking sleep medications if possible. Mixing medications such as zolpidem, lorazepam, and eszopiclone with alcohol or other sedating medications is dangerous. It can even be fatal. 

Make sure your prescriber knows about all the medications you take, including those prescribed by other healthcare professionals you see.

Frequently asked questions

First-line treatment for insomnia in older adults is cognitive behavioral therapy rather than sleep medication. If someone over 65 years old needs prescription sleep medication, it’s usually best to first try low doses of non-habit-forming options, like orexin receptor antagonists (suvorexant or lemborexant), melatonin receptor agonists (ramelteon), or doxepin. A melatonin supplement may also be a good option for some people.

Medications that treat shift work disorder are often aimed at helping people stay awake during their shifts. Examples include armodafinil (Nuvigil) and modafinil (Provigil). To help with sleep, strategic light exposure, melatonin supplements, and environmental interventions (like blackout curtains), are often the first-line approaches.

Antihistamines like diphenhydramine and doxylamine are typically considered the strongest over-the-counter sleep medications. But this means they also come with greater risks, like dizziness, daytime drowsiness, and memory problems.

The bottom line

Insomnia is a common problem and it can have a significant impact on your life and health. The most effective and safest ways to treat insomnia include good sleep habits and cognitive behavioral therapy. If you think you may need sleep medication, it’s important to work closely with your healthcare team to choose the safest option for you. Sleep medications come with serious risks, like dependence, potentially dangerous sleep behaviors, and even memory loss. It’s best to take these medications over the short term to minimize the health risks.

why trust our exports reliability shield

Why trust our experts?

Christina Aungst, PharmD, MWC is a senior pharmacy editor for GoodRx. She began writing for GoodRx Health in 2019.
Katie E. Golden, MD, is a board-certified emergency medicine physician and a medical editor at GoodRx.

References

Hershner, S., et al. (2020). Shift work. Sleep Education.

Howell, H. R., et al. (2011). Prescription sleep aids for the treatment of insomnia. U.S. Pharmacist.

GoodRx Health has strict sourcing policies and relies on primary sources such as medical organizations, governmental agencies, academic institutions, and peer-reviewed scientific journals. Learn more about how we ensure our content is accurate, thorough, and unbiased by reading our editorial guidelines.

Was this page helpful?

Latest articles