Sleep quality is shaped by far more than diet — light exposure, stress, screen time and sleep schedule all matter enormously — but certain nutrients have a genuine, mechanistic role in the body’s ability to wind down. Chief among them is magnesium.
The Sleep Micronutrient: Magnesium
Magnesium acts as a natural relaxant by binding to gamma-aminobutyric acid (GABA) receptors, the neurotransmitter responsible for quieting nerve activity. Low magnesium status has been associated with poorer sleep quality in observational research, and magnesium also plays a supporting role in regulating melatonin, the hormone that governs the sleep-wake cycle. Vitamin B6 and calcium work alongside it — B6 is a required cofactor in the pathway that converts dietary tryptophan into serotonin and, eventually, melatonin, while calcium helps the brain use tryptophan to manufacture melatonin in the first place.
This hub gathers the foods and compounds from across the encyclopedia with the strongest, most practical magnesium content — the nuts, seeds and legumes most worth reaching for if sleep-supportive nutrition is the goal.
Foods that support Better Sleep
Key compounds linked to Better Sleep
Recipes to try
Common questions
Does eating magnesium-rich food right before bed actually help you fall asleep? The research is more about overall status than a single pre-bed dose — consistently low magnesium intake over time is what’s linked to poorer sleep quality in studies, not a lack of magnesium in your last meal specifically. Building magnesium-rich foods into your regular diet is likely to matter more than timing any one food around bedtime.
Should I take a magnesium supplement for sleep instead? Food sources are generally preferable as a first step, since it’s very difficult to over-consume magnesium from diet alone, whereas supplemental magnesium can cause digestive upset at higher doses. If diet alone isn’t enough, that’s a conversation worth having with a doctor rather than self-prescribing a high-dose supplement.
Explore other health goals
- Best Foods for Heart Health
- Best Foods for Blood Sugar Control
- Best Anti-Inflammatory Foods
- Best Foods for Bone Health
- Best Foods for Brain Health
- Best Foods for Energy and Performance
- Best Foods for Gut Health
- Best Foods for Immune Support
- Best Foods for Skin Health
- Best Foods for Weight Management
- Best Foods for Eye Health
- Best Foods for Weight Gain
- Best Foods for Muscle Growth
- Best Foods for Healthy Hair
- Best Foods for Liver Health



