There is no single “best” over-the-counter sleep aid because the right choice depends on whether your sleep problem is falling asleep, staying asleep, or both. The most common OTC options fall into three categories: antihistamines, melatonin, and supplements like magnesium. Each works differently, and each has trade-offs worth understanding before you buy anything off the shelf.
The American Academy of Sleep Medicine recommends that the first-line treatment for ongoing insomnia is cognitive behavioral therapy for insomnia (CBT-I), a structured program that retrains your sleep habits. Medications and supplements are generally considered when CBT-I isn’t available, hasn’t fully worked, or you need short-term help while building better sleep patterns.
Antihistamines: The Most Common Choice
The active ingredient in most OTC sleep aids sold at pharmacies is either diphenhydramine (the ingredient in Benadryl, ZzzQuil, and many store brands) or doxylamine (the ingredient in Unisom SleepTabs). Both are first-generation antihistamines that cause drowsiness by blocking histamine receptors in the brain. They’re the only OTC ingredients specifically marketed and approved for short-term sleeplessness.
Doxylamine tends to be more sedating than diphenhydramine, which is why some people find it more effective for staying asleep through the night. Diphenhydramine is more widely available and comes in more product formulations. Both have a long duration of action, which creates one of their biggest drawbacks: morning grogginess. Because these drugs stay active in your system for several hours after you wake up, they can leave you feeling drowsy, foggy, and slower to react well into the next day. The CDC’s occupational safety division has flagged this as a concern for shift workers and anyone who needs to be alert in the morning.
The other major limitation is tolerance. In a controlled trial, participants taking diphenhydramine twice daily found that the sedative effects were completely indistinguishable from placebo by the end of three days. That’s remarkably fast. Even at a once-nightly dose, tolerance builds within a matter of days, which means these drugs lose their effectiveness quickly if you use them regularly. They’re genuinely useful for the occasional bad night, but they’re a poor solution for ongoing sleep problems.
Older adults should be especially cautious with antihistamine sleep aids. These drugs carry anticholinergic effects that can cause confusion, dry mouth, urinary retention, and increased fall risk, and the effects are more pronounced with age.
Melatonin: Better for Timing Than Sedation
Melatonin is not a sedative. It’s a hormone your brain produces naturally as darkness falls, signaling to your body that it’s time to prepare for sleep. Taking supplemental melatonin works best when your internal clock is out of sync, such as after jet lag, during shift work, or when your natural sleep window has drifted later than you’d like.
Most people take far too much. The NHS recommends a starting dose of 2 mg for adults, taken one to two hours before bedtime for short-term sleep problems, or 30 minutes to one hour before bed for longer-term use. Many supplements sold in the U.S. contain 5 to 10 mg per dose, which is significantly more than what clinical guidelines suggest and can actually disrupt sleep by throwing off your hormone balance. Starting low, around 0.5 to 1 mg, and increasing only if needed is a more effective approach for most people.
There’s also a quality control problem. A study analyzing 13 commercial melatonin supplements found that 11 of them contained less melatonin than the label claimed, with deficits ranging from 5% to nearly 68%. One product contained 31% more than advertised. Because supplements aren’t regulated the same way as drugs in the U.S., what’s on the label and what’s in the pill can differ dramatically. Choosing a product that carries a third-party testing seal (USP, NSF, or ConsumerLab) reduces this risk.
If your problem is lying awake for an hour after getting into bed, melatonin taken at the right dose and time can help. If your problem is waking at 3 a.m. and not falling back asleep, melatonin is less likely to help unless you use a slow-release formulation.
Magnesium: Modest but Real Benefits
Magnesium has gained popularity as a sleep supplement, particularly in the glycinate form, which is more easily absorbed and less likely to cause digestive issues than other forms like magnesium oxide. A randomized, double-blind, placebo-controlled crossover trial found that magnesium supplementation led to significant improvements in sleep duration, deep sleep, and sleep efficiency compared to placebo. Participants also showed improvements in mood and heart rate variability, a marker of how well the body recovers during rest.
The effects are generally more subtle than what you’d feel from an antihistamine. Magnesium works best for people who are mildly deficient, which is fairly common since many adults don’t get enough through diet alone. If your magnesium levels are already adequate, supplementing may not make a noticeable difference. Common dietary sources include nuts, seeds, leafy greens, and whole grains.
Valerian Root: Weak Evidence
Valerian root is one of the most popular herbal sleep remedies, sold in capsules and teas in virtually every pharmacy. The evidence behind it, however, is disappointing. A randomized clinical trial gave participants 300 mg of concentrated valerian extract or placebo 30 minutes before bedtime for two weeks. There were no statistically significant differences between valerian and placebo on any measure: not sleep latency, not time spent awake during the night, not sleep efficiency, and not self-rated sleep quality. The average difference in time to fall asleep was less than one minute.
Some people report that valerian helps them relax, and the placebo effect is genuinely powerful when it comes to sleep. But if you’re choosing between options based on evidence, valerian is one of the weakest.
How to Choose the Right Option
Your choice should match the type of sleep problem you’re having and how often it occurs.
- Occasional sleepless night (travel, stress, schedule disruption): Diphenhydramine or doxylamine will likely knock you out, but plan for some morning grogginess and don’t rely on them for more than two or three consecutive nights.
- Trouble falling asleep at your target bedtime: Low-dose melatonin (0.5 to 2 mg) taken one to two hours before bed can help shift your sleep timing. This is especially useful for night owls trying to sleep earlier.
- General restlessness and light sleep: Magnesium glycinate is worth trying as a nightly supplement. The effects build over days to weeks rather than working on the first night.
- Chronic insomnia lasting more than a few weeks: No OTC product is a good long-term solution. CBT-I has the strongest evidence of any insomnia treatment and addresses the root patterns that keep insomnia going, rather than masking them chemically.
What Actually Matters More Than the Pill
No sleep aid, prescription or otherwise, works well against poor sleep habits. Keeping a consistent wake time every day (including weekends) is the single most powerful thing you can do for sleep quality. Your body’s internal clock anchors to when you wake up, not when you go to bed.
Bright light exposure in the first hour after waking reinforces that anchor. Avoiding screens or using blue-light filters in the last hour before bed allows your natural melatonin to rise. Keeping your bedroom cool, around 65 to 68°F, supports the drop in core body temperature your body needs to initiate sleep. Caffeine has a half-life of roughly five to six hours, meaning half the caffeine from your 2 p.m. coffee is still in your system at 7 or 8 p.m.
These adjustments are free, have no side effects, and compound over time. An OTC sleep aid can serve as a useful bridge while you build these habits, but the habits themselves are what create lasting, reliable sleep.