Magnesium vs Melatonin: Which One Actually Helps You Stay Asleep?

Melatonin's strongest evidence is for falling asleep faster or shifting your body clock, not staying asleep. Magnesium's evidence for staying asleep is real but modest, from a small number of trials. Neither is a strong fix for 3am waking specifically. They work through different mechanisms, and taking both isn't unusual, but expect a small effect, not a switch.
A close-up of assorted pills and supplement bottles.
Photo: Nastya Dulhiier / Unsplash

These are the two supplements people ask me about most, usually as a straight either-or question. The honest answer is that they're not really competing for the same job, and understanding that difference matters more than picking a winner.

What does each one actually do?

Melatonin is a hormone tied to your body's internal clock. As a supplement, its most consistent evidence is for sleep onset, falling asleep faster, and for shifting circadian timing, which is why it's genuinely useful for jet lag. A government health technology review summarizing the trial evidence found effects on sleep maintenance were mixed and inconsistent across studies (CADTH Health Technology Review, 2022). Full detail on dosing and timing is in the melatonin article.

Magnesium works differently, as a mineral involved in nervous system regulation generally, not a circadian signal. A 2025 randomized trial found magnesium bisglycinate modestly reduced insomnia severity compared to placebo over the study period. The effect was real but small, and the specific form used mattered, since not all magnesium compounds absorb the same way. Full detail is in the magnesium article.

Which has better evidence for staying asleep specifically?

Magnesium, by a narrow margin, if staying asleep is genuinely your problem rather than falling asleep in the first place. That's a real distinction worth sitting with. Melatonin's evidence is more consistent for the front end of the night. Neither one has the kind of strong, repeated trial evidence that would let me say it reliably fixes a 3am waking. Both are modest tools, not solutions, and I'd rather tell you that plainly than oversell either one.

Where magnesium and melatonin's evidence is strongest A two-column comparison. Melatonin's column lists falling asleep faster and shifting circadian timing as its strongest evidence. Magnesium's column lists general relaxation and a modest effect on staying asleep. Melatonin Falling asleep faster Shifting circadian timing Magnesium General relaxation Modest help staying asleep
Illustrative summary of the evidence discussed in this article, not a formal comparison rating.

Can you take them together?

There's no strong evidence against it. They work through different mechanisms, so combining them isn't redundant the way taking two melatonin products would be. Some people take magnesium in the evening generally and melatonin closer to bedtime specifically, timed to its own purpose. I'd still rather you go in with modest expectations for either, alone or combined, than assume stacking supplements multiplies the effect.

When to see a doctor

Both are generally considered safe for short-term use in healthy adults, but magnesium can interact with certain antibiotics, and both can interact with blood pressure medication, so check with a doctor or pharmacist before starting, especially if you take other medications. If 3am waking happens most nights regardless of what you try, or comes with snoring or gasping, that's worth raising directly, since sleep apnea is a common cause neither supplement will touch.

Sources