Ingredient Check
Magnesium vs Melatonin: Which Is Better for Sleep at 3am, and Which One Belongs at 10pm
One is a clock and the other is a brake. That single distinction settles most of the argument, and it explains why so many people conclude that both of them failed when what actually happened is that they picked the wrong one.
A clock and a brake
These two get shelved together and compared as if they were rivals for the same job. They are not. They are barely in the same business.
Melatonin is a hormone your body already makes as light falls. Taking it is sending a message about what time it is. That is genuinely useful when your internal clock has drifted — after a long flight, on night shifts, or when you have slid into falling asleep at two in the morning and want to move that back.
Magnesium is a mineral involved in the machinery that quiets the nervous system down. It is not sending a message about time. It is topping up a raw material, which is why it takes weeks rather than an evening, and why its effect is largest in people who were running low to begin with.
So the honest framing is not which is stronger. It is which part of your night is failing.
The key point People decide melatonin "stopped working" when it was never aimed at their problem. A clock signal cannot reach into the middle of the night, because by then it has already done the only thing it does. Luciano Andreoti, Content Contributor
What melatonin is genuinely good at
It is worth giving melatonin its due, because the internet swings between treating it as a sleeping pill and dismissing it entirely, and neither is right.
Where it is on firm ground is the body clock. Sun and Chen, reviewing circadian rhythm sleep-wake disorders in Current Neuropharmacology in 2022, describe timed melatonin as one of the standard tools for shifting a clock that has drifted out of phase. If your problem is when you sleep rather than how you sleep, that is the mechanism you want.
Where it is shakier is as a general fix for insomnia. Choi and colleagues, reviewing melatonin for chronic insomnia in Sleep Medicine Reviews in 2022, found the improvements real but small, with the strength of the evidence limited. Well tolerated, modest effect, narrower than the shelf implies.
And there is one practical finding almost no packaging mentions. The 2024 dose-response meta-analysis by Cruz-Sanabria and colleagues in the Journal of Pineal Research, pooling 26 randomised double-blind trials, found that timing mattered more than dose. Taking it meaningfully earlier in the evening did more than pushing milligrams up. Most people do the opposite: same time, bigger tablet.
What magnesium is genuinely good at
Magnesium's case is narrower and, for the 3am problem, better aimed.
The trial worth knowing is recent and specific. Schuster and colleagues, in Nature and Science of Sleep in 2025, ran a double-blind placebo-controlled trial in 155 adults reporting poor sleep, using 250 mg of elemental magnesium a day in the bisglycinate form. Over four weeks the supplement group improved more than placebo on the Insomnia Severity Index. The gain was modest, and it was largest in people whose diets were low in magnesium to begin with.
Zoom out and the picture stays measured. Mah and Pitre pooled the randomised trials in older adults with insomnia in BMC Complementary Medicine and Therapies in 2021 and called the evidence suggestive but low in certainty. That is a fair description, and it is still the strongest hand in this category for sleep maintenance.
One thing the form decides for you. The trial used bisglycinate, and the form is not cosmetic — citrate carries a bowel effect that can itself wake you, which we took apart in magnesium citrate vs glycinate for sleep.
Which one is yours
Find your night in the left column. The answer is in the right one, and for a good share of readers it is not the bottle they already own.
| What your night looks like | The better fit | Why |
|---|---|---|
| You lie awake for an hour before dropping off | Melatonin | A timing problem, and timing is what it moves |
| You fall asleep fine, then wake at 3am | Magnesium | The clock signal has already been delivered by then |
| Jet lag, or a shift rota | Melatonin | A displaced clock is exactly what it is for |
| Wired, tense, mind racing at bedtime | Magnesium | Works on the quieting side rather than on the hour |
| Restless legs or night cramps alongside the waking | Magnesium | The mineral is involved in muscle relaxation too |
| You want something for tonight | Melatonin | It acts the same evening; magnesium takes weeks |
| You want something for the next few months | Magnesium | Cumulative by design, and a mineral rather than a hormone |
Two rows go to melatonin outright, and that is not a courtesy. If your sleep starts too late, magnesium is the wrong purchase and no amount of it will fix the hour.
Taking both, and how that goes wrong
Plenty of formulas carry both, and there is nothing incoherent about that. A small amount of melatonin as an evening cue, with magnesium doing the structural work, is a reasonable design.
What goes wrong is the ratio. A great many products marketed for night waking are melatonin products with a decorative pinch of magnesium behind them. They are built for onset and sold for maintenance, and the buyer concludes that neither ingredient works.
So read the order on the panel. If magnesium is first and stated in elemental milligrams, and melatonin is last and small, the formula agrees with the evidence. If melatonin leads, you are holding an onset product regardless of what the front of the box says.
One more thing worth keeping straight: melatonin is a hormone and magnesium is a mineral. That is not a scare, it is a reason to treat nightly long-term melatonin with more caution than the packaging suggests, and to raise it with a doctor if months go by and you still cannot sleep without it.
If your answer came out magnesium
If the table sent you to melatonin, buy plain melatonin at a low dose and take it earlier in the evening than feels natural — that is the finding from the 2024 meta-analysis, and it costs very little to act on. If it sent you to magnesium, the form and the order on the panel are what to check, and here is one that gets both right.
Sonnus Sleep Gummies
Magnesium in front, melatonin at 0.9 mg behind it — built for the middle of the night
This is the ratio the article argues for, in the right order. Magnesium bisglycinate is the base and the ingredient carrying the placebo-controlled trial. L-theanine, apigenin and GABA sit behind it as the settling layer, with lemon balm for the physical side of winding down. Melatonin appears last, at a low 0.9 mg, working as an evening cue rather than as the engine — which is what separates a maintenance formula from an onset product with extras. Full label and pricing in our Sonnus review.
Look elsewhere if: the table pointed you at melatonin — a plain melatonin taken earlier in the evening is cheaper and better aimed than any combination formula. Also speak with your doctor first if you are pregnant, take prescription sleep, mood or blood-pressure medication, or have reduced kidney function. And if the night waking is nightly and has run for months, that is a medical conversation rather than a purchase.
The honest bottom line
Neither ingredient wins this outright, and any page that says otherwise is selling one of them. Melatonin moves the hour and magnesium calms the system, and those are answers to two different complaints.
If sleep starts too late, take melatonin and take it earlier than you think. If sleep starts fine and breaks in the middle, magnesium in the bisglycinate form is the better-aimed purchase, and the guide to staying asleep all night covers what else belongs in that formula.
Either way, set expectations where the research sets them. Melatonin gives a modest shift, mostly in timing. Magnesium gives a modest improvement over about four weeks, largest if your diet was short on it. Modest is the honest word for both, and it is still worth having.
Frequently asked questions
Is it better to take magnesium or melatonin for sleep?
It depends on which part of the night is failing. If you lie awake at the start, melatonin is aimed at your problem, because it shifts when the body expects sleep. If you drop off fine and wake in the small hours, magnesium is the better fit — and it is the one with a 2025 placebo-controlled trial pointed at that half of the night.
Can I take magnesium and melatonin together?
Many formulas combine them, and the combination is sensible when melatonin is kept small and magnesium is doing the main work. What is worth avoiding is a product that is mostly melatonin with a token amount of magnesium behind it, sold as though it addresses night waking. Check the order and the amounts on the panel.
Why did melatonin stop working for me?
Most often it was never matched to the problem. Melatonin is a timing signal rather than a sedative, so it has little to say about what happens once you are already asleep. A 2024 dose-response meta-analysis also found that taking it earlier in the evening mattered more than taking more of it, which is the opposite of what most people try.
Which one works faster, magnesium or melatonin?
Melatonin, by a wide margin — it acts on the same night. Magnesium is cumulative: the 2025 trial ran four weeks before measuring. That difference is not a mark against magnesium, it is simply what the two are doing. One is sending a signal, the other is topping up a mineral.
Is melatonin safe to take every night?
Reviews of chronic insomnia have generally found melatonin well tolerated in the short term, but long-term nightly use in healthy adults is less well studied than the packaging implies. It is a hormone, not a mineral, and that distinction is worth respecting. If you find yourself needing it nightly for months, that is a conversation with a doctor.
When is night waking a medical issue rather than a supplement question?
If it happens nightly and has lasted more than a few weeks, if you snore heavily or wake gasping, if you take prescription sleep or mood medication, or if low mood arrived alongside it. Chronic insomnia and sleep apnoea are diagnoses with real treatments, and a supplement is not the right tool for either.