Nutrition for Sleep Quality — Melatonin Foods, Tryptophan, Magnesium, and the Gut-Brain Connection
A research-backed guide to the foods and nutrients that support sleep quality, covering melatonin-containing foods, the tryptophan pathway, magnesium glycinate, L-theanine, glycine, and practical meal timing for Australian readers.
Dr. Claire Sanderson
PhD Nutritional Biochemistry
27 April 2026
20 min read
Educational disclaimer: This article is general nutrition education, not medical advice. Sleep disorders, insomnia, and circadian rhythm disruptions have many potential causes and require individualised clinical assessment. Nothing here substitutes for advice from your GP, a sleep physician, or an Accredited Practising Dietitian. If you are experiencing significant sleep difficulties, seek professional guidance before making major dietary or supplement changes.
Most discussions of sleep optimisation focus on behaviour — screen time, room temperature, sleep schedules. These matter, and the evidence behind them is solid. But the dietary dimension of sleep quality is under-discussed relative to the evidence base that now exists. A reasonably large body of RCT and observational data links specific foods, nutrients, and dietary patterns to measurable improvements in sleep onset, sleep duration, and sleep architecture. This article works through that evidence honestly, covering what is well-supported, what is promising but preliminary, and where the marketing has run ahead of the science.
The tryptophan pathway: why what you eat affects melatonin
The connection between diet and sleep runs through a biochemical cascade that starts with a single amino acid. Tryptophan is an essential amino acid — meaning the body cannot synthesise it and must obtain it entirely from food. Once absorbed, tryptophan is taken up across the blood-brain barrier, where it becomes the direct precursor to serotonin via hydroxylation by tryptophan hydroxylase. Serotonin, in turn, is the substrate from which the pineal gland synthesises melatonin, the primary hormonal signal of darkness and sleep timing.
This pathway has a practical implication: dietary tryptophan availability influences serotonin synthesis, which influences melatonin production. It is not a simple linear relationship — tryptophan competes with other large neutral amino acids (LNAAs) for the same blood-brain barrier transporter, so the ratio of tryptophan to competing amino acids matters as much as absolute tryptophan intake. Meals combining tryptophan-containing foods with carbohydrates exploit this: insulin release from carbohydrate digestion drives competing LNAAs into muscle tissue, temporarily increasing the tryptophan-to-LNAA ratio in the blood and enhancing brain uptake.
This is the mechanistic basis behind the folk wisdom of warm milk and crackers before bed. The biochemistry is real, even if the milk itself is a modest tryptophan source.
There is a second consideration: the rate-limiting step in melatonin synthesis is enzyme activity in the pineal gland, which is driven primarily by light exposure rather than substrate availability alone. Dietary tryptophan supports the system, but it cannot override the suppression of melatonin caused by bright blue-light exposure in the evening. Both matter.
Foods that contain dietary melatonin
Beyond supporting the synthesis pathway, some foods contain melatonin directly. Dietary melatonin is absorbed and measurably raises plasma melatonin concentrations, though typically to a lesser degree than exogenous supplementation. The research on specific foods is more developed than popular accounts suggest.
Tart cherry juice
Tart (Montmorency) cherries are among the most concentrated dietary sources of melatonin and have the strongest RCT evidence of any food in this category. A randomised crossover trial by Howatson and colleagues (2012, European Journal of Nutrition) gave participants either tart cherry juice concentrate or a placebo drink for seven days. The cherry juice group showed significantly higher urinary melatonin excretion, along with increases in total sleep time and sleep efficiency measured by actigraphy. A separate trial in older adults with insomnia found that tart cherry juice reduced wake time after sleep onset and improved sleep efficiency compared to placebo.
The active constituents are melatonin itself (Montmorency cherries contain approximately 13 ng/g of fresh weight, which is high relative to other fruits), along with anthocyanins and procyanidins that may contribute via anti-inflammatory and antioxidant mechanisms. Tart cherry is distinct from sweet cherry; the Montmorency variety used in most studies has a sour flavour and is not widely available fresh in Australia. However, tart cherry juice concentrate and capsule extracts are increasingly available through health food retailers and online. A typical research dose is 250–480 mL of juice or the equivalent extract taken in two doses: morning and 1–2 hours before bed.
Kiwi fruit
The kiwi fruit sleep study is one of the more cited pieces of dietary sleep research despite its limitations. A 2011 study by Lin and colleagues published in Asia Pacific Journal of Clinical Nutrition gave 24 adults two kiwi fruits one hour before bedtime nightly for four weeks. Sleep diary and actigraphy data showed significant improvements in sleep onset latency (falling asleep faster), sleep duration, and sleep efficiency compared to baseline. There was no placebo control, which is a meaningful limitation, but the effect sizes were clinically plausible and the dose is straightforward.
Kiwi fruit contains melatonin, serotonin precursors, and is a rich source of folate and antioxidants. Whether melatonin content, serotonin precursor activity, or another mechanism drives the effect remains unclear. Practically, kiwi fruit is inexpensive, widely available in Australia year-round, and eating two in the evening is a low-risk intervention worth trying.
Pistachios
Pistachios deserve specific mention because they contain exceptionally high concentrations of melatonin compared to other plant foods — approximately 660 ng/g, which is substantially higher than cherries or kiwi. A 28 g serving of pistachios provides a meaningful dose of dietary melatonin alongside magnesium, tryptophan, protein, and fibre. No large RCT has specifically studied pistachios and sleep in isolation, but their nutrient profile makes them a rational evening snack: the combination of melatonin, tryptophan, and magnesium in a single food is genuinely useful.
Oats and eggs
Oats contain melatonin at moderate concentrations and are a reasonable source of tryptophan. They also provide slow-digesting carbohydrate, which supports the tryptophan-to-LNAA ratio mechanism described above. A warm bowl of oats in the evening is mechanistically sound as a sleep-supporting meal component, not merely comfort food.
Eggs are a useful tryptophan source (approximately 167 mg per 100 g) and contain choline, which is involved in neurotransmitter synthesis. Including eggs in an evening meal can contribute to tryptophan intake without large competing LNAA loads, particularly if the meal also includes moderate carbohydrate.
Tryptophan-rich foods and the timing question
For dietary tryptophan to support melatonin synthesis in the window that matters for sleep, timing relative to bed matters. The synthesis chain — tryptophan to serotonin to melatonin — takes hours. Eating tryptophan-rich foods approximately 2–3 hours before intended sleep time aligns the peak absorption and conversion window with melatonin secretion onset in the early evening.
The highest dietary tryptophan sources include:
- Turkey: approximately 250 mg per 100 g of cooked breast. The association between turkey and sleepiness at large holiday meals is probably more attributable to caloric volume and alcohol than tryptophan specifically, but turkey remains a legitimately good source.
- Pumpkin seeds: approximately 560 mg per 100 g — among the highest plant sources. A small handful (30 g) in the evening provides around 170 mg tryptophan alongside magnesium and zinc. Roasted pumpkin seeds are a practical Australian option.
- Firm tofu: approximately 190 mg per 100 g, making it a useful tryptophan source for plant-based eaters. Evening tofu-based meals with rice or sweet potato create an appropriate tryptophan-plus-carbohydrate combination.
- Hard cheeses: cheddar contains approximately 320 mg per 100 g. The long-standing cultural practice of a small cheese portion before bed has plausible mechanistic support, though portion sizes should be modest to avoid the potential sleep-disrupting effect of large fat loads close to bedtime.
The evidence on tryptophan supplementation (as opposed to food-derived tryptophan) is more mixed. Supplemental tryptophan at doses of 1–2 g has shown sleep benefits in some trials, but the food-matrix effect — where other components of the meal modulate absorption and competing amino acid ratios — is absent in isolated supplementation, which may partly explain variable results.
Magnesium and sleep: forms matter
Magnesium occupies a central position in sleep physiology that goes beyond its reputation as a "relaxation mineral." Magnesium is a cofactor for over 300 enzymatic reactions, including those involved in adenosine triphosphate synthesis, serotonin production, and the regulation of GABA — the primary inhibitory neurotransmitter in the brain. GABA activity is directly linked to sleep induction and maintenance; GABA agonists include some of the most commonly prescribed sleep medications. Magnesium potentiates GABA receptor activity and also antagonises NMDA (glutamate) receptors, reducing excitatory neurotransmission, which is part of why magnesium deficiency is associated with hyperexcitability and difficulty switching off.
Deficiency is common. Australian Bureau of Statistics data suggests a substantial proportion of the population — estimated at 40–50% in some age groups, particularly women and older adults — does not meet the estimated average requirement for magnesium from diet alone. The estimated average requirement for adults is 255–265 mg/day for women and 330–350 mg/day for men.
RCT evidence
A 2012 double-blind randomised trial (Journal of Research in Medical Sciences) in 46 older adults with insomnia supplemented magnesium at 500 mg/day for eight weeks. The treatment group showed significant improvements in sleep onset latency, sleep duration, sleep efficiency, and early morning waking compared to placebo. Serum melatonin levels also rose in the supplementation group, which is consistent with magnesium's role as a cofactor in melatonin synthesis.
A 2021 systematic review and meta-analysis found that magnesium supplementation improved subjective sleep quality and sleep efficiency, with the strongest effects in older adults and those with documented baseline deficiency.
Glycinate versus other forms
Not all magnesium supplements are equivalent in terms of bioavailability or sleep relevance:
- Magnesium glycinate (magnesium bound to glycine) is among the best-absorbed oral forms and produces lower rates of GI distress than oxide or sulphate. The glycine component has independent sleep-supporting evidence (see below), which makes glycinate a rational choice specifically for sleep.
- Magnesium threonate (Magtein) has been specifically studied for central nervous system penetration and cognitive applications, with some sleep data, but it is substantially more expensive.
- Magnesium oxide is the most common form in lower-cost supplements but has poor bioavailability (approximately 4% absorption in some studies) and is not the form used in most sleep-related RCTs.
- Magnesium citrate is reasonably well absorbed but has a laxative effect at higher doses.
For sleep-specific use, magnesium glycinate at 200–400 mg taken in the evening is the most evidence-aligned choice. Dietary sources include pumpkin seeds, dark leafy greens, almonds, cashews, black beans, and dark chocolate.
L-theanine: relaxation without sedation
L-theanine is an amino acid found almost exclusively in green tea and, at lower concentrations, black tea. It is not a sedative in the pharmacological sense — it does not act on GABA receptors as benzodiazepines do — but it produces a distinctive neurological state that has made it one of the more interesting nutritional compounds for sleep preparation.
EEG studies consistently show that L-theanine increases alpha wave activity in the brain — the frequency pattern associated with a wakeful but relaxed mental state, the kind experienced during meditation or quiet unfocused attention. In a 2012 randomised crossover study, 50 mg of L-theanine produced measurable alpha wave increases within 45 minutes, with subjective reports of relaxation without drowsiness. Higher doses in the 100–200 mg range, used in multiple RCTs, have shown reductions in stress response (salivary cortisol, heart rate variability improvements) and self-reported improvements in sleep quality, particularly sleep preparation and reduced nighttime waking.
The mechanism appears to involve modulation of glutamate and dopamine activity, along with mild GABA agonism, rather than direct sedation. L-theanine taken in the evening does not impair alertness the next day and has a strong safety profile across trials. A typical research dose is 100–400 mg, which exceeds what a standard cup of green tea provides (approximately 20–40 mg per cup), making supplementation the more practical delivery route for therapeutic intent.
Practically, two to three cups of green tea in the afternoon — avoiding caffeine timing issues discussed below — provides moderate L-theanine exposure, and for those who want a more targeted evening dose, 200 mg L-theanine as a standalone supplement is a widely available and low-risk option.
Glycine: the 3-gram before-bed RCT
Glycine is a non-essential amino acid that functions as an inhibitory neurotransmitter in the spinal cord and brainstem, and as a co-agonist at NMDA receptors in the forebrain. Its role in sleep physiology was clarified by a series of Japanese studies, most notably by Inagawa and colleagues (2006, Sleep and Biological Rhythms) and subsequent work by Bannai and colleagues.
The key RCT by Bannai et al. (2012, Sleep and Biological Rhythms) gave participants 3 g of glycine before bed for three nights. Polysomnographic and actigraphy data showed that glycine significantly reduced sleep onset latency and improved sleep efficiency compared to placebo. Critically, daytime fatigue and neurocognitive performance the following morning were also better in the glycine group — suggesting improved sleep quality rather than sedation. A separate crossover study found that 3 g glycine before bed reduced subjective fatigue and improved reaction time in participants with chronically restricted sleep.
The proposed mechanism involves glycine's role in reducing core body temperature via peripheral vasodilation — the same thermoregulatory mechanism that explains why a warm bath before bed improves sleep onset. Glycine supplementation appears to facilitate the normal nocturnal drop in core temperature that signals sleep readiness to the circadian system. Glycine is also a major structural amino acid in collagen, so collagen peptide supplements (typically providing 2–3 g glycine per serving) may carry secondary sleep benefits.
At 3 g per night — the dose used in the Inagawa/Bannai studies — glycine is extremely safe, inexpensive, and has no meaningful reported adverse effects. It can be dissolved in water or mixed into a pre-bed herbal tea.
What hurts sleep: alcohol, caffeine, and late eating
Understanding supportive nutrition is incomplete without addressing what disrupts sleep at the dietary level.
Alcohol and REM suppression
Alcohol is a sedative and reliably reduces sleep onset latency — which is why it is so commonly used as a sleep aid. The problem is that its effects on sleep architecture are deeply disruptive. Alcohol is metabolised throughout the night, and as blood alcohol levels fall in the second half of the night, the brain rebounds with a hyperexcitable state that fragments sleep and suppresses rapid eye movement (REM) sleep. REM sleep is the stage associated with emotional processing, memory consolidation, and cognitive restoration. A review published in Alcoholism: Clinical and Experimental Research found dose-dependent REM suppression from even moderate alcohol consumption (1–2 standard drinks), with suppression concentrated in the first sleep cycle. The quality cost of alcohol accumulates even when people report subjectively "sleeping fine."
Understanding sleep architecture and memory consolidation makes the REM suppression cost of alcohol harder to dismiss — the phases of sleep that alcohol most reliably degrades are precisely those most important for cognitive performance the following day.
Caffeine and adenosine
Caffeine works by competitively blocking adenosine receptors. Adenosine is the primary sleep-pressure neurotransmitter: it accumulates throughout the day as a byproduct of neuronal energy metabolism, and rising adenosine levels drive the increasing sleepiness experienced across waking hours. Caffeine does not eliminate adenosine; it simply occupies the receptor binding site. When caffeine is metabolised, adenosine — which has continued to accumulate — floods the unblocked receptors, often producing the characteristic afternoon crash.
The half-life of caffeine in adults is approximately 5–7 hours, with meaningful individual variation based on CYP1A2 genetic polymorphisms, liver function, and smoking status. At the population level, a double espresso consumed at 3 pm will still have approximately half its caffeine load active at 8–9 pm, depending on individual metabolism. Research using polysomnography has shown that caffeine consumed even six hours before bed measurably reduces slow-wave (deep) sleep, even when subjective sleep onset is not perceived as impaired. This means caffeine's sleep cost is partly invisible to the person experiencing it.
The practical threshold for most adults is a caffeine cutoff of 12–2 pm, depending on sensitivity. High-sensitivity individuals (slow metabolisers) may need an earlier cutoff. Caffeine sources beyond coffee to account for include strong black tea, energy drinks, pre-workout supplements, and dark chocolate — which contains approximately 20–60 mg caffeine per 40 g serving.
Late and large meals
Eating large meals close to bed increases gastric acid production, slows gastric emptying, and raises core body temperature — all of which work against the physiological conditions needed for sleep initiation. The research on meal timing and sleep is less developed than the caffeine or alcohol literature, but observational data consistently associates late eating (within 1–2 hours of bed) with worse sleep quality and longer sleep onset. Allowing 2–3 hours between the last significant meal and bed is a reasonable guideline supported by both physiology and observational evidence.
The gut-brain axis and sleep
The gut-brain axis — the bidirectional communication network linking intestinal microbiota to the central nervous system via the vagus nerve, enteric nervous system, and systemic immune and endocrine pathways — has an increasingly well-characterised relationship with sleep.
The mechanisms are multiple. Gut bacteria produce a range of neuroactive compounds, including short-chain fatty acids, GABA, serotonin precursors (approximately 90% of the body's serotonin is produced in the gut), and gamma-aminobutyric acid itself. The intestinal environment therefore directly influences the substrate availability for sleep-related neurotransmitter synthesis. Beyond direct neurotransmitter production, microbial metabolites modulate systemic inflammation; chronically elevated inflammatory markers including interleukin-6 and tumour necrosis factor-alpha are associated with sleep fragmentation and altered sleep architecture. This creates a bidirectional problem: poor sleep disrupts microbiome composition (several studies show measurable shifts in microbial diversity after even two nights of sleep restriction), and a dysbiotic microbiome impairs the gut-derived contributions to sleep-supporting neurochemistry.
Observational studies consistently find associations between higher microbiome diversity — typically measured as alpha diversity on 16S rRNA sequencing — and better self-reported sleep quality. A 2019 study in PLOS ONE found that specific microbiome features, including abundance of Lachnospiraceae and Blautia species, correlated with sleep efficiency and total sleep time in healthy volunteers.
The probiotic literature on sleep is still developing but shows early promise. A small RCT published in Beneficial Microbes (2019) found that a multi-strain probiotic supplement containing Lactobacillus helveticus and Bifidobacterium longum significantly improved sleep quality and reduced stress cortisol in adults with moderate stress and poor sleep, compared to placebo. A systematic review of probiotic interventions and sleep (Han et al., 2022, Nutrients) found seven trials with generally positive effects on sleep latency and sleep quality, acknowledging that the field is still methodologically heterogeneous.
For a fuller treatment of how microbiome diversity intersects with sleep regulation and what probiotic selection evidence actually shows, the probiotic strain selection guide covers the clinical trial data in detail.
The dietary pattern most strongly associated with microbiome diversity, which in turn links to sleep quality, is broadly consistent with the Mediterranean diet and sleep quality evidence — high dietary fibre, diverse plant intake, fermented foods, and limited ultra-processed food. The sleep benefit of these patterns may be partly mediated by microbiome effects, though disentangling direct sleep nutrient contributions from microbiome-mediated effects remains methodologically challenging in human trials.
Practical meal timing and application
Translating the above into a practical approach involves two main levers: what to eat and when.
Two to three hours before bed:
- A moderate-carbohydrate, moderate-protein meal with tryptophan-rich protein sources (turkey, eggs, tofu, cheese, pumpkin seeds) creates the LNAA competition ratio that supports tryptophan brain uptake.
- Including colour-diverse vegetables supports gut microbiome diversity and fibre intake.
- Avoiding very large portion sizes reduces the gastric acid and thermoregulation cost of late digestion.
- The Mediterranean-style dinner — grilled fish or chicken with roasted vegetables and a grain like barley or quinoa — fits this profile well.
In the hour before bed:
- Two kiwi fruits or a small serving of tart cherry juice concentrate are the highest-evidence single food interventions.
- A small handful of pistachios provides melatonin, tryptophan, and magnesium in one package.
- 3 g of glycine dissolved in warm water or herbal tea is practical and well-tolerated.
- Magnesium glycinate (200–400 mg) is ideally taken with a small amount of food in the evening.
- L-theanine (100–400 mg) if not already obtained from afternoon green tea.
What to time earlier:
- Last caffeine dose by 12–2 pm for most people; earlier for slow metabolisers.
- Alcohol, if consumed, should be complete at least 3–4 hours before bed to reduce the second-half REM disruption — acknowledging that no gap fully eliminates the sleep architecture cost.
If you are navigating demanding work schedules, irregular shifts, or environments that make consistent sleep timing difficult, the practical strategies at sleep optimisation for night shift and coders cover chronotype alignment and circadian entrainment strategies that complement the dietary approaches discussed here.
Australian context: availability and supplement quality markers
A few practical notes specific to the Australian context:
Tart cherry: Fresh Montmorency cherries are not widely available in Australia. Tart cherry juice concentrate (typically from New Zealand or European sources) is available through health food retailers and online. Freeze-dried capsule extracts are an alternative. Products should specify "Montmorency" or "tart cherry" variety rather than generic cherry extract, and the juice should not be sweetened with added sugar, which is common in mainstream supermarket cherry drinks.
Magnesium supplements: The Australian market contains a wide range of magnesium products, many of which are magnesium oxide — the poorly absorbed form that is inexpensive to manufacture. Quality markers for a sleep-specific magnesium supplement include: the form clearly listed as glycinate, bisglycinate, or threonate; elemental magnesium content (not just total compound weight) disclosed on the label; third-party testing certification (e.g., Informed Sport, Informed Choice, or a TGA-listed product with an AUST L or AUST R number). Avoid products listing only "magnesium" without specifying the salt form — this is almost always oxide.
L-theanine: Widely available in Australia as a standalone supplement or in combination sleep formulas. Suntheanine is a patented form with the most clinical backing; products using this ingredient typically note it on labelling. Generic L-theanine from reputable suppliers is also effective.
Glycine: Available as a standalone powder from most sports nutrition and health supplement retailers. It is inexpensive, effectively flavourless, and easily added to water or herbal tea. There is no meaningful quality differentiation for glycine powder beyond basic purity — look for products without fillers, sweeteners, or flavouring if adding to an existing evening drink.
For those interested in the broader research landscape on circadian biology, peptide compounds including Epitalon (a tetrapeptide studied for pineal function and circadian regulation) and Selank (an anxiolytic peptide with sleep-adjacent applications) represent an adjacent area of preclinical and early clinical research — the RetaLABS research catalogue covers the literature on these compounds for those researching beyond dietary interventions.
Summary
The dietary science of sleep is more developed than the popular discourse reflects. The tryptophan-serotonin-melatonin pathway gives dietary protein sources a mechanistic role in melatonin synthesis, with timing relative to bed determining whether the substrate availability aligns with the melatonin production window. Foods with direct melatonin content — particularly tart cherry juice and kiwi fruit — have RCT evidence supporting sleep outcome improvements. Magnesium glycinate has strong trial support, particularly in deficient populations. Glycine at 3 g before bed has robust polysomnographic evidence for reducing sleep onset latency and improving sleep architecture. L-theanine promotes alpha wave relaxation without sedation. The gut-brain axis links microbiome diversity to sleep quality through neurotransmitter precursor production and inflammatory regulation. On the disruption side, alcohol reliably degrades REM sleep and caffeine consumed in the afternoon measurably reduces slow-wave sleep — even when subjective sleep onset feels normal.
No individual food or nutrient is a substitute for adequate total sleep opportunity, consistent sleep timing, and a light environment that supports circadian melatonin release. But within those foundations, there is genuine evidence that what you eat — and when — has meaningful influence on how well you sleep.
Educational Disclaimer
This article is for educational and informational purposes only and does not constitute medical advice. Always consult a qualified healthcare professional regarding your specific health situation.
Dr. Claire Sanderson
PhD Nutritional Biochemistry · BSc (Hons) Human Biology
Claire’s doctoral research focused on mitochondrial substrate metabolism and dietary interventions. She writes to bridge peer-reviewed literature and practical health decisions.
Full bio