Written & reviewed by Cory B., founder of NappyTi.me
Researched and fact-checked against peer-reviewed sleep studies, government health agencies (NIH, CDC), and established medical references (AASM, Sleep Foundation). Educational content — not a substitute for professional medical advice. See our editorial policy and methodology.
Sleep and Diet: Foods That Help (and Hurt) Your Sleep
This guide is written for educational purposes using published sleep research and major medical references where possible. It is not medical advice. Review our editorial standards.

Diet is the sleep lever most people ignore because it feels indirect — what a 9 PM burrito has to do with 3 AM wakeups isn't obvious until you actually track it. It matters more than almost any bedtime habit short of light exposure.
The Two-Way Street: Sleep Affects Diet, Diet Affects Sleep
Before diving into specific foods, it's important to understand that this relationship is bidirectional. Poor sleep increases cravings for high-sugar, high-fat foods by disrupting hunger hormones (ghrelin and leptin). And eating those foods, in turn, degrades sleep quality — creating a vicious cycle.
A landmark study from Columbia University found that participants who slept fewer than 5 hours consumed an average of 300 more calories the next day, predominantly from fatty snacks and carbohydrate-heavy foods. Understanding how much sleep you actually need is the first step in breaking this cycle.
Foods That Promote Better Sleep
Tryptophan-Rich Foods
Tryptophan is an amino acid your body uses to produce serotonin, which is then converted to melatonin — the hormone that regulates your sleep-wake cycle. Foods rich in tryptophan include:
- Turkey and chicken — Yes, the Thanksgiving sleepiness stereotype has a grain of truth
- Eggs — Particularly the egg whites
- Cheese and dairy — The "warm milk before bed" advice has biochemical support
- Nuts and seeds — Especially pumpkin seeds, which are also rich in magnesium
- Tofu and soy products — Good plant-based tryptophan sources
Important nuance: tryptophan competes with other amino acids to cross the blood-brain barrier. Eating tryptophan-rich foods with a small amount of carbohydrates (like whole grain toast) actually improves absorption by triggering insulin release, which clears competing amino acids from the bloodstream.
Magnesium-Rich Foods
Magnesium is involved in over 300 enzymatic processes, including the regulation of neurotransmitters that calm the nervous system. Research suggests that magnesium deficiency is linked to insomnia, and supplementation improves sleep quality in older adults. Natural sources include:
- Dark leafy greens (spinach, kale, Swiss chard)
- Almonds and cashews
- Dark chocolate (in moderation — watch the caffeine content)
- Avocados
- Bananas
- Legumes (black beans, chickpeas)
Melatonin-Containing Foods
Some foods naturally contain melatonin, though in much smaller amounts than supplements. These include:
- Tart cherries: The standout. Multiple studies show tart cherry juice increases both melatonin levels and sleep duration. A Louisiana State University study found that adults who drank tart cherry juice twice daily slept an average of 84 minutes longer.
- Kiwi fruit: A study from Taipei Medical University found that eating two kiwis one hour before bed reduced sleep onset time by 35% after four weeks.
- Walnuts
- Fatty fish (salmon, sardines) — also high in omega-3s and vitamin D, both linked to better sleep regulation
Foods and Habits That Hurt Sleep
Heavy, Late-Night Meals
Eating a large meal within 2–3 hours of bedtime forces your digestive system to work when it should be resting. This raises core body temperature (the opposite of what you need — see our bedroom optimization guide) and can cause acid reflux, which is significantly worse when lying down.
My personal rule: finish dinner at least 3 hours before bed. If I'm genuinely hungry later, I opt for a small, easily digestible snack — a banana with almond butter or a small handful of walnuts.
Spicy Foods
Capsaicin (the active compound in chili peppers) raises core body temperature and can cause digestive discomfort. A study in the International Journal of Psychophysiology found that adding Tabasco and mustard to evening meals increased the time it took to fall asleep and reduced overall sleep quality.
Alcohol
This deserves its own section because it's the most misunderstood sleep disruptor. Alcohol feels like it helps you sleep — it's a sedative, and it does reduce sleep onset latency. But the research is unambiguous: alcohol devastates sleep quality.
- It suppresses REM sleep in the first half of the night (critical for memory and emotional processing)
- It causes rebound wakefulness in the second half as your body metabolizes the alcohol
- It relaxes throat muscles, worsening snoring and sleep apnea
- It's a diuretic, increasing nighttime bathroom trips
- Even moderate drinking (2 drinks) reduces sleep quality by 24% according to a JMIR study of over 4,000 participants
I gave up weeknight drinking for a month as an experiment and the sleep data was striking: REM sleep increased from 18% to 24% of total sleep time, and nighttime awakenings dropped from 3–4 to 0–1.
Sugar and Refined Carbohydrates
A study published in the American Journal of Clinical Nutrition found that diets high in refined sugar and processed carbohydrates were associated with more nighttime awakenings and lighter sleep. The blood sugar spikes and crashes disrupt stable sleep architecture throughout the night.
Meal Timing: When You Eat Matters
Your digestive system has its own circadian rhythm. Research from the Salk Institute shows that time-restricted eating (consuming all food within a 10–12 hour window) improves sleep quality independent of what you eat. This is likely because late-night eating sends conflicting signals to your body clock — food intake signals "daytime" to your peripheral clocks even while darkness signals "nighttime" to your master clock.
Practical timing guidelines:
- Last large meal: At least 3 hours before bedtime
- Light snack (if needed): 1 hour before bed — something small with tryptophan or magnesium
- Caffeine cutoff: 8–10 hours before bed (see our caffeine guide for details)
- Alcohol: If you drink, stop at least 3–4 hours before bed to allow metabolism
My Evening Nutrition Routine
After experimenting for over a year, here's what I've settled on:
- Dinner at 6:30–7:00 PM: Balanced meal with protein, vegetables, and complex carbs. I avoid spicy food at dinner entirely.
- No food after 8:00 PM: If hungry, I'll have chamomile tea, which has mild sedative properties through apigenin binding to benzodiazepine receptors.
- Evening snack (optional, 8 PM): Two kiwis or a small bowl of tart cherries. Both have genuine research support.
- No alcohol on weeknights. On weekends, I stop drinking by 7 PM if my bedtime is 10:30.
Combined with proper sleep hygiene and using our sleep calculator to time my bedtime correctly, nutrition has become one of the most impactful — and most overlooked — pillars of my sleep optimization.
Key Takeaways
- Tryptophan + carbs before bed supports melatonin production
- Tart cherry juice and kiwi fruit have the strongest evidence for improving sleep
- Finish your last large meal at least 3 hours before bedtime
- Alcohol is a sleep destroyer despite feeling like a sleep aid
- Magnesium-rich foods support nervous system relaxation
- Time-restricted eating (10–12 hour window) improves sleep quality
- The diet-sleep relationship is bidirectional — fixing one helps the other
Frequently Asked Questions
- How long before bed should I stop eating?
- Aim to finish your last substantial meal about three hours before bed. Digestion raises core temperature and, lying down, increases reflux risk — both work against sleep onset. A small carbohydrate-plus-protein snack an hour before bed is fine and can help if hunger wakes you.
- Does tart cherry juice really help you sleep?
- It has the strongest food-based evidence of the options here. Small randomised trials found modest increases in total sleep time and efficiency, likely via naturally occurring melatonin and anti-inflammatory anthocyanins. The effect is real but small — think minutes, not hours.
- Should I take a magnesium supplement for sleep?
- Food sources first: pumpkin seeds, almonds, spinach, black beans. If you supplement, glycinate and citrate are better tolerated than oxide, and evidence is strongest in people who are actually deficient rather than as a general sedative.
- Why does alcohol make me fall asleep fast but wake at 3 AM?
- Alcohol is sedating early, then metabolises into a stimulant-like rebound. It suppresses REM in the first half of the night and fragments the second half as blood alcohol falls — which is why 3 AM wakeups follow evening drinks so predictably.
- Is late caffeine or a late dinner worse for sleep?
- Caffeine, in most cases. Its half-life of roughly five hours means an afternoon coffee is still measurably in your system at bedtime, while a late meal mainly affects comfort and sleep onset rather than sleep architecture.