Sleep & Stress

Magnesium vs Melatonin for Sleep: Which One Do You Need, and for Which Half of the Night?

By the Best Supplements Today editorial team · Updated

A man sitting on the edge of his bed in a dark bedroom in the middle of the night

Quick answer. Melatonin wins the start of the night. Magnesium wins the middle. Melatonin is a timing signal — it tells the body evening has arrived, which is why it helps when sleep starts too late and does almost nothing at 3 a.m. Magnesium works on the nervous system’s braking side and is cumulative, so it belongs to the staying-asleep half.

These two get shelved together and compared as if they were rivals for the same job. They’re barely in the same business.

A clock and a brake

Melatonin is a hormone your body already makes as light falls. Taking it is sending a message about what time it is. Genuinely useful when your internal clock has drifted — after a long flight, on night shifts, or when you’ve 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. It isn’t sending a message about time. It’s 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.

So the honest framing isn’t which is stronger. It’s which part of your night is failing.

What melatonin is genuinely good at

Where it’s 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 a standard tool for shifting a clock that’s drifted out of phase.

Where it’s 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 evidence limited.

And 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 the milligrams up.

What magnesium is genuinely good at

Narrower, and for the 3 a.m. problem, better aimed.

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 group improved more than placebo on the Insomnia Severity Index.

Zoom out and the picture stays measured. Mah and Pitre pooled the trials in older adults with insomnia in BMC Complementary Medicine and Therapies in 2021 and called the evidence suggestive but low in certainty. That’s fair — and it’s still the strongest hand in this category for sleep maintenance.

Which one is yours

What your night looks likeThe one aimed at it
You lie awake for an hour before going underMelatonin
Your sleep has drifted later and laterMelatonin
You’re crossing time zones or on shiftsMelatonin
You fall asleep fine and wake at 3 a.m.Magnesium
You wake several times and surface easilyMagnesium
Your diet is short on greens, nuts and beansMagnesium

Taking both, and how that goes wrong

Plenty of formulas carry both, and there’s 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’re built for onset and sold for maintenance, and the buyer concludes 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’re holding an onset product regardless of what the front says.

One more thing worth keeping straight: melatonin is a hormone and magnesium is a mineral. That’s not a scare — it’s a reason to treat nightly long-term melatonin with more care than the packaging suggests, and to raise it with a doctor if months go by and you can’t sleep without it.

If your answer came out magnesium

Sonnus is built on that ratio: magnesium in the gentle bisglycinate form doing the structural work, with melatonin present as a small evening cue rather than the engine. Four weeks of nightly use is what the evidence describes, so the gummy format is doing more work than it appears to.

Look elsewhere if your answer came out melatonin. Then a plain melatonin, taken earlier in the evening than you’d expect, is the cheaper and better-aimed buy.

Questions people ask

Is it better to take magnesium or melatonin for sleep?

Depends which half of your night is broken. Melatonin moves when sleep starts, so it fits trouble falling asleep and a drifted clock. Magnesium works on the nervous system’s braking side over weeks, so it fits waking in the middle of the night.

Can I take magnesium and melatonin together?

Yes, and many formulas do. Watch the ratio rather than the combination: magnesium should be first and stated in elemental milligrams, with melatonin small and late in the list. A product led by melatonin is an onset product no matter what the front of the box claims.

Why did melatonin stop working for me?

Often it never was working on the problem you have. If your complaint is waking at 3 a.m., melatonin was adjusting the front of the night the whole time. It’s also worth checking the timing — the pooled trials found taking it earlier in the evening did more than raising the dose.

Which one works faster?

Melatonin, easily — it acts the same evening. Magnesium is cumulative and the trial ran four weeks before measuring. If you want something for tonight, that’s melatonin; if you want the middle of your nights to change, that’s a month of magnesium.

Is melatonin safe every night?

It’s well tolerated in the trials, but it’s a hormone rather than a nutrient, and long-term nightly use hasn’t been studied the way people use it. If months pass and you can’t sleep without it, that’s worth raising with a doctor rather than continuing quietly.

When is night waking a medical issue?

If it happens nightly, if you snore heavily or wake gasping for air, or if it arrived with low mood or anxiety. Sleep apnoea and chronic insomnia are diagnoses, and both are treatable — neither is a supplement question.