Sleep

How Nutrition Affects Sleep Quality

Michael Gonzales By Michael Gonzales Updated 10 min read

Quick answer

Diet has modest effects on sleep. The clearest are caffeine, which disturbed sleep even six hours before bed, and alcohol, which fragments the second half of the night. Fiber, tart cherry, kiwifruit and magnesium have only small trials behind them.

Nutrition for Enhanced Sleep Quality

What and when you eat can affect your sleep, but food is a modest lever. Caffeine and alcohol timing have the clearest effects. Fiber and saturated fat intake have been linked to how deeply people sleep. Specific foods such as tart cherry juice and kiwifruit, and nutrients such as magnesium and tryptophan, have only small or early trials behind them.

Key Takeaways

  • 400 mg of caffeine taken even six hours before bed reduced sleep in a controlled study, so an early-afternoon cutoff is a reasonable rule.
  • Alcohol can help people fall asleep faster but disrupts the second half of the night and reduces REM sleep at moderate and higher doses.
  • In a small inpatient study, more fiber predicted more deep (slow wave) sleep, while more saturated fat predicted less.
  • Tart cherry juice and kiwifruit improved some sleep measures in trials of 20 to 24 people; one kiwifruit study had no control group.
  • Short sleep raised hunger and appetite in a lab study, and extending sleep by about 1.2 hours a night lowered daily calorie intake by about 270 kcal in a randomized trial.
  • Adults are advised to sleep 7 or more hours a night on a regular basis.

Evidence grade: Emerging. Caffeine and alcohol effects on sleep are well documented, but evidence for specific foods and nutrients comes from small, short trials and a few low-to-moderate quality reviews.

How Diet Connects to Sleep

Melatonin is a hormone that helps regulate the sleep-wake cycle, and a few foods, such as tart cherries, contain it. Tryptophan is an amino acid that has been tested as a sleep supplement. Magnesium is a cofactor in more than 300 enzyme systems, including those involved in muscle and nerve function. Diet can also affect sleep indirectly through stimulants, alcohol and how heavy or late your meals are. None of these pathways makes a single food a reliable sleep aid, but together they explain why researchers study diet at all.

Caffeine and Alcohol Timing

Caffeine

In a 2013 study, adults took 400 mg of caffeine at bedtime, three hours before bed or six hours before bed, or a placebo, and were monitored at home. All three caffeine times disturbed sleep compared with placebo. Even at six hours, the loss of total sleep was large enough that the authors supported avoiding substantial caffeine for at least six hours before bedtime. Remember that tea, cola, energy drinks and some supplements also contain caffeine. Our article on the impact of caffeine on sleep patterns goes deeper.

Alcohol

A 2013 review of studies in healthy volunteers found that alcohol at all doses shortened the time to fall asleep and made the first half of the night more consolidated, but increased sleep disruption in the second half. It consistently delayed the first REM period, and at moderate and high doses it reduced total REM sleep. A nightcap may feel helpful at lights-out while making the later part of the night worse.

What You Eat During the Day

In a 2016 inpatient study, 26 normal-weight adults ate a controlled diet for four days and then chose their own food on day five, with their sleep recorded each night. After the self-selected day, they had less slow wave (deep) sleep and took longer to fall asleep. Across participants:

  • Higher fiber intake predicted less light stage 1 sleep and more slow wave sleep.
  • A higher share of calories from saturated fat predicted less slow wave sleep.
  • A higher share of calories from sugar and other non-fiber carbohydrates was associated with more arousals.

The study was small, lasted one day of free eating, and shows associations. Still, it fits a pattern that is easy to follow: meals built around vegetables, legumes, whole grains and fruit rather than sweets and fatty, processed foods.

Foods and Nutrients Studied for Sleep

Food or nutrient What the study did What it found Limits
Tart cherry juice concentrate 20 healthy adults, 7 days, placebo-controlled crossover Higher urinary melatonin; longer time in bed and total sleep time, higher sleep efficiency Very small, one week
Kiwifruit 24 adults with self-reported sleep problems ate 2 kiwifruit 1 hour before bed for 4 weeks Time to fall asleep fell 35%; total sleep time rose 13% No control group; mostly women
Magnesium bisglycinate (250 mg magnesium) 155 adults reporting poor sleep, 4 weeks, placebo-controlled Slightly greater improvement on a sleep-symptom questionnaire than placebo Small effect size; self-reported outcomes
Tryptophan supplements Meta-analysis of 4 studies drawn from 18 articles Less time awake after falling asleep, especially at 1 g or more a day Other sleep measures unchanged; supplements, not food
Fiber (diet pattern) 26 adults, sleep recorded in a lab More fiber predicted more deep sleep Association from one day of free eating

Tryptophan

A 2022 meta-analysis found that tryptophan supplements shortened wake time after sleep onset, with doses of 1 g or more doing better than lower doses, but did not affect other parts of sleep. These were supplement studies, and none of them tested whether tryptophan-containing foods change sleep.

Magnesium

The RDA for magnesium is 400 to 420 mg a day for men and 310 to 320 mg a day for women. Good food sources listed by the NIH include pumpkin seeds (156 mg per ounce), chia seeds (111 mg per ounce), almonds (80 mg per ounce), boiled spinach (78 mg per half cup) and black beans (60 mg per half cup). In the 2025 bisglycinate trial, the authors noted larger improvements among people with lower dietary magnesium intake, a pattern they said needs confirmation. For a food-first approach, see foods high in magnesium, and for the differences between supplement forms, see magnesium L-threonate vs glycinate.

If you want a supplement, OPA Magnesium Glycinate provides 275 mg of elemental magnesium per three-capsule serving from magnesium glycinate. It contains no melatonin and is designed to support relaxation and sleep quality as part of a nightly routine.

Tart cherry and kiwifruit

Tart Montmorency cherries contain melatonin, and in the 2012 trial the juice concentrate raised the body's melatonin output as well as sleep time and efficiency. The kiwifruit study reported larger changes, but without a comparison group it cannot separate the fruit from expectation or routine. Both are reasonable foods to enjoy; neither has been tested in large trials.

Melatonin Supplements

Melatonin from supplements is different from melatonin in food. According to the National Center for Complementary and Integrative Health (NCCIH), melatonin supplements may help with jet lag after travel across time zones. Short-term use appears safe for most people, but long-term safety data are lacking. The NCCIH also notes that a 2017 test of 31 melatonin products found that most did not contain the amount on the label. Use the label dose and talk to a healthcare provider before using it regularly.

Sleep, Appetite and Weight Research

The link between sleep and eating runs in both directions, and the research is easy to overstate. Here is what two well-known trials actually measured.

  • Short sleep and appetite. In a 2004 crossover study of 12 healthy young men, two nights of restricted sleep compared with two nights of extended sleep lowered leptin, a fullness hormone, by 18%. It raised ghrelin, a hunger hormone, by 28%, and increased hunger by 24% and appetite by 23%. The rise was largest for calorie-dense, high-carbohydrate foods. The study was very small and did not measure energy expenditure.
  • Longer sleep and calorie intake. In a 2022 randomized trial, 80 adults with overweight who usually slept less than 6.5 hours received one sleep-hygiene counseling session aimed at 8.5 hours in bed. Their sleep increased by about 1.2 hours a night, and their measured calorie intake fell by about 270 kcal a day compared with controls, with no significant change in energy expenditure. It was a short, single-center study in a specific group.

These findings support treating sleep as part of overall health habits. They do not mean that sleeping more will produce a predictable change in weight. The expert consensus from the American Academy of Sleep Medicine and Sleep Research Society is that adults should sleep 7 or more hours per night on a regular basis.

A Sleep-Friendly Eating Day

  • Have your last caffeinated drink at least six hours before bed.
  • Keep alcohol modest and well before bedtime, or skip it on nights you want your best sleep.
  • Build meals around fiber-rich foods such as vegetables, beans, oats and fruit.
  • Include magnesium sources such as pumpkin seeds, almonds, spinach and black beans.
  • If you are hungry late, choose a small snack over a large meal.
  • Choose caffeine-free evening drinks; our guide to herbal teas and their calming effects has options.
  • Keep a regular sleep schedule that allows at least 7 hours.

Safety and Interactions

  • Magnesium: The upper limit for magnesium from supplements is 350 mg a day for adults. It covers all supplements and medicines combined, not food. High doses can cause diarrhea, nausea and abdominal cramping. Take oral bisphosphonates at least 2 hours apart from magnesium. Take tetracycline or quinolone antibiotics at least 2 hours before or 4 to 6 hours after it. If you take diuretics or proton pump inhibitors, or have kidney problems, talk to your doctor or pharmacist first.
  • Melatonin: The NCCIH advises people taking any medicine to check with their healthcare provider first. People with epilepsy and those taking blood thinners need medical supervision. Safety in pregnancy and breastfeeding has not been well studied, and allergic reactions are possible.
  • Caffeine and alcohol: If you take medications, ask your pharmacist whether caffeine or alcohol affects them or your sleep.
  • Ongoing sleep problems: If poor sleep lasts for weeks, or you snore loudly or feel very sleepy during the day, talk to a doctor rather than relying on food or supplements.

Frequently Asked Questions

What foods help you sleep better?

No food is a reliable sleep fix. Small trials found improvements in some sleep measures with tart cherry juice and kiwifruit, and a diet higher in fiber was linked to deeper sleep. Pumpkin seeds, almonds, chia, spinach and beans are good magnesium sources.

How late can I drink coffee without affecting sleep?

In a controlled study, 400 mg of caffeine disturbed sleep even when taken six hours before bed. A common rule is to stop caffeine at least six hours before bedtime, earlier if you are sensitive.

Does alcohol help you sleep?

Alcohol can shorten the time it takes to fall asleep, but research in healthy volunteers shows it disrupts the second half of the night and reduces REM sleep at moderate and higher doses.

Does magnesium help with sleep?

The evidence is limited. A 2025 trial of 155 adults reporting poor sleep found that 250 mg of magnesium as bisglycinate improved questionnaire scores slightly more than placebo over four weeks. Stay within the 350 mg supplemental upper limit unless your doctor advises otherwise.

Does sleep affect appetite and weight?

In a small lab study, short sleep raised hunger hormones and appetite. In a randomized trial, extending sleep by about 1.2 hours a night lowered calorie intake by about 270 kcal a day. These are short studies, and sleep is one factor among many.

Does meal timing affect sleep?

Research on exact meal timing is limited. What you eat during the day matters too: in one study, more fiber predicted more deep sleep, and more sugar and saturated fat predicted lighter sleep with more arousals.

Sources

  1. NIH Office of Dietary Supplements. Magnesium: Fact Sheet for Health Professionals.
  2. National Center for Complementary and Integrative Health. Melatonin: What You Need To Know. NIH. 2024.
  3. Watson NF, Badr MS, Belenky G, et al. Recommended amount of sleep for a healthy adult: a joint consensus statement of the American Academy of Sleep Medicine and Sleep Research Society. Sleep. 2015.
  4. Drake C, Roehrs T, Shambroom J, Roth T. Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. J Clin Sleep Med. 2013.
  5. Ebrahim IO, Shapiro CM, Williams AJ, Fenwick PB. Alcohol and sleep I: effects on normal sleep. Alcohol Clin Exp Res. 2013.
  6. St-Onge MP, Roberts A, Shechter A, Choudhury AR. Fiber and saturated fat are associated with sleep arousals and slow wave sleep. J Clin Sleep Med. 2016.
  7. Howatson G, Bell PG, Tallent J, et al. Effect of tart cherry juice (Prunus cerasus) on melatonin levels and enhanced sleep quality. Eur J Nutr. 2012.
  8. Lin HH, Tsai PS, Fang SC, Liu JF. Effect of kiwifruit consumption on sleep quality in adults with sleep problems. Asia Pac J Clin Nutr. 2011.
  9. Schuster J, Cycelskij I, Lopresti A, Hahn A. Magnesium bisglycinate supplementation in healthy adults reporting poor sleep: a randomized, placebo-controlled trial. Nat Sci Sleep. 2025.
  10. Sutanto CN, Loh WW, Kim JE. The impact of tryptophan supplementation on sleep quality: a systematic review, meta-analysis, and meta-regression. Nutr Rev. 2022.
  11. Spiegel K, Tasali E, Penev P, Van Cauter E. Brief communication: sleep curtailment in healthy young men is associated with decreased leptin levels, elevated ghrelin levels, and increased hunger and appetite. Ann Intern Med. 2004.
  12. Tasali E, Wroblewski K, Kahn E, Kilkus J, Schoeller DA. Effect of sleep extension on objectively assessed energy intake among adults with overweight in real-life settings: a randomized clinical trial. JAMA Intern Med. 2022.

Disclosure: OPA Nutrition sells supplements, including products mentioned in this article. This content is for education only and is not medical advice. Statements about dietary supplements have not been evaluated by the Food and Drug Administration. These products are not intended to diagnose, treat, cure, or prevent any disease. Talk to your healthcare provider before using any supplement, especially if you take medication or have a medical condition.

Written and reviewed by Michael Gonzales, Founder, OPA Nutrition · Last reviewed: · How OPA researches and writes

Michael Gonzales

Written by

Michael Gonzales

Health & fitness consultant

Michael has a diverse set of skills and passions, with a full-time career as an airline pilot and a dedicated focus on health and fitness consulting. He understands the importance of balancing a busy lifestyle with maintaining a healthy mind and body, and is committed to helping others achieve the same success. Michael's expertise in health and fitness is not just limited to physical training, but also extends to nutrition, stress management, and overall wellbeing. He takes a holistic approach to health and fitness, helping clients to achieve their goals in a sustainable and fulfilling way. With a strong desire to inspire and motivate others, Michael is always ready to share his time and knowledge with those who seek his guidance. Whether in the air or on the ground, Michael is dedicated to helping others live their best lives.

This article is for general education and isn't medical advice. Talk with your healthcare provider before starting a new supplement, especially if you take medication, are pregnant or are nursing.

Recent Posts