Most sleep medications have not been proven safe during pregnancy, and the options that carry the least risk are more limited than you might expect. The American College of Physicians recommends non-drug approaches as the first-line treatment for insomnia in general, and that guidance applies even more strongly during pregnancy, where every medication carries at least some uncertainty about fetal effects. Still, when sleeplessness becomes severe, a few options have enough safety data to be worth discussing with your provider.
Why There’s No Simple “Safe List”
The FDA used to assign letter grades (A, B, C, D, X) to medications based on pregnancy risk. Those categories were eliminated because they were “overly simplistic” and didn’t effectively communicate real-world risk. In their place, drug labels now include narrative summaries of the actual human and animal data available. The practical result: there’s no neat tier system you can look up. Safety depends on the specific drug, the trimester, your health history, and how the limited evidence is interpreted.
For most sleep medications, the honest answer is that we don’t have large, rigorous studies in pregnant women. What we do have is a patchwork of smaller studies, animal data, and decades of observational use. That context matters as you evaluate each option below.
Over-the-Counter Antihistamines
Diphenhydramine (the active ingredient in Benadryl and many “PM” products) and doxylamine (found in Unisom SleepTabs) are the two OTC antihistamines most commonly asked about. Both cause drowsiness, which is why they’re marketed as sleep aids. Doxylamine in particular has been widely used during pregnancy as part of a nausea treatment, giving it a long track record of exposure data.
However, Johns Hopkins Medicine specifically lists pregnancy as a reason not to use either diphenhydramine or doxylamine as sleep aids. This doesn’t necessarily mean a single dose will cause harm. It reflects the fact that routine, unsupervised use hasn’t been established as safe for this purpose. Many OB providers still consider occasional use of these antihistamines acceptable on a case-by-case basis, particularly doxylamine, but “available over the counter” is not the same as “safe to take nightly without guidance.”
Melatonin Supplements
Melatonin occupies an unusual middle ground. Johns Hopkins Medicine advises against using it during pregnancy. Yet a 2024 clinical trial published in BMJ Open described oral melatonin as “known to be safe for pregnant women and babies,” noting that published clinical studies in pregnant populations have not reported serious adverse reactions. That trial is testing 3 mg nightly starting at 39 weeks of gestation.
The contradiction reflects a broader problem with supplements: melatonin is not regulated as a drug, so dosing, purity, and formulation vary widely between brands. The amount of melatonin in a supplement can differ significantly from what’s on the label. Even researchers who consider melatonin itself low-risk in pregnancy acknowledge that it hasn’t been formally approved for use during pregnancy. If you’re considering it, the dose, timing, and product quality all matter, and it’s worth having that specific conversation rather than picking a bottle off the shelf.
Prescription Options With Limited Data
Trazodone
Trazodone is an antidepressant frequently prescribed off-label for insomnia because of its sedating effects. Its pregnancy safety data is more reassuring than most prescription sleep drugs, though still limited. Studies covering over 300 first-trimester exposures found no increased chance of birth defects above the baseline risk. Two studies with over 200 participants found no increase in miscarriage. One study found no greater chance of preterm delivery or low birth weight, though another study of similar size did find a slightly higher preterm delivery rate.
The main concern with trazodone is its effect on newborns when used late in pregnancy. Like many medications that affect brain chemistry, it can cause temporary symptoms in babies after birth, including jitteriness, breathing difficulties, or trouble feeding. One small study of 18 infants exposed to a low dose (50 mg per day) for insomnia in the third trimester reported no withdrawal symptoms, but no long-term studies have looked at whether trazodone affects a child’s behavior or learning development.
Zolpidem
Zolpidem (the active ingredient in Ambien) crosses the placenta, and relatively little is known about its safety in pregnancy. A CDC-supported analysis of over 62,000 pregnancies found that early-pregnancy zolpidem use was rare, occurring in about 0.2% of both birth defect cases and healthy controls. The results did not support a large increase in risk for birth defects, but the numbers were too small to rule out smaller increases in risk for specific defects. In practical terms, the data is simply too thin to call it safe or clearly dangerous.
Benzodiazepines
Benzodiazepines like lorazepam and diazepam are sometimes prescribed for anxiety-related insomnia, but their pregnancy profile is concerning. A meta-analysis combining data from multiple studies found that case-control research showed a threefold increase in the odds of major malformations and a nearly twofold increase in oral cleft (cleft lip or palate) with fetal exposure. Pooled cohort studies were more reassuring, showing no clear association. The conflicting data has kept benzodiazepines in a “generally avoid during pregnancy” category for most providers, especially during the first trimester when facial structures are forming.
Magnesium Supplements
Magnesium glycinate has gained popularity as a gentle sleep aid, and many pregnant women already take magnesium for leg cramps or general supplementation. The recommended daily intake for women is 310 to 320 mg depending on age (360 mg for teens), though pregnancy, diet, and other medications can change that number. Magnesium from food is not a concern, but supplemental magnesium can cause digestive issues at higher doses, and too much can build up dangerously if you have kidney problems.
There’s no strong clinical evidence that magnesium supplements meaningfully improve insomnia during pregnancy specifically. They’re unlikely to cause harm at appropriate doses, which makes them a reasonable thing to try, but expectations should be modest. The glycinate form tends to be easier on the stomach than other forms like magnesium oxide.
Non-Drug Approaches Come First
Cognitive behavioral therapy for insomnia (CBT-I) is the treatment with the strongest evidence for insomnia in general, and it carries zero fetal risk. A randomized controlled trial published in Obstetrics & Gynecology confirmed its effectiveness specifically for prenatal insomnia. CBT-I typically involves four to eight sessions focused on restructuring sleep habits: consistent wake times, limiting time in bed when you’re not sleeping, addressing anxious thoughts about sleep, and relaxation techniques. Several apps and online programs now offer guided CBT-I, making it more accessible than traditional in-person therapy.
Beyond CBT-I, practical sleep hygiene changes can make a real difference during pregnancy. Sleeping on your left side with a pillow between your knees reduces pressure on your back and bladder. Keeping your bedroom cool helps counteract the higher body temperature that comes with pregnancy. Limiting fluids in the two hours before bed cuts down on nighttime bathroom trips, which are one of the most common sleep disruptors in the second and third trimesters.
When Snoring or Gasping Is the Problem
If your sleep trouble involves loud snoring, gasping, or waking up feeling unrefreshed no matter how many hours you spend in bed, the issue may be obstructive sleep apnea rather than insomnia. Sleep apnea becomes more common during pregnancy due to weight gain, nasal congestion, and fluid shifts. It’s diagnosed through an overnight sleep study that measures how many times per hour your breathing stops or becomes shallow. Mild cases involve 5 to 14 interruptions per hour, moderate 15 to 29, and severe 30 or more.
The treatment is a CPAP machine, which delivers gentle air pressure through a mask to keep your airway open. It requires no medication, is safe during pregnancy, and can dramatically improve sleep quality. Custom oral devices that reposition the jaw are a second-line option for mild to moderate cases. If you suspect sleep apnea, treating it will do far more for your sleep than any pill.

