The Relationship Between Nutrition and Sleep Quality and the Best Foods to Eat for Better Sleep

Nutrition plays a significant role in sleep quality. Consuming too much caffeine late in the day is a common issue that negatively affects sleep. Eating close to bedtime disrupts the circadian rhythm and hinders the body's restoration process during sleep. A plant-based diet rich in fiber, omega-3, and vitamin D promotes good sleep. Good nutrition is essential for quality sleep, while poor nutrition can lead to sleep problems like insomnia.

Many things can impact your overall sleep quality—and nutrition plays a surprisingly large role in how well you can sleep at night.

When it comes to sleep and nutrition, Brooke Stubbs, MD, a double board-certified internal medicine and lifestyle medicine physician, sees her fair share of patients who don’t achieve adequate nutrition to positively affect sleep.

In fact, one of the top issues she sees is consuming too much caffeine late in the day, which is one of the leading offenders related to diet and sleep. [1]

Ahead, we’ll delve into the relationship between sleep and nutrition and offer easy dietary changes you can make to improve your sleep. We’ll also share a list of the best foods for sleep.

What is nutrition?

Just so you have an understanding before going further, Stubbs defines nutrition as “the exogenous [external] components of food and supplements that provide our bodies with biochemicals necessary for energy, growth, and cellular function.”

In other words? Nutrition is what fuels everything you do, from your waking hours to your sleeping hours.

nutrition and sleep infographic

What’s the relationship between nutrition and sleep quality?

There’s a scientifically proven connection between nutrition and sleep and sleep and nutrition. [2, 3] Basically, it’s widely known that a well-rounded diet can support healthy sleep.

When you sleep well, you’re more likely to make healthy food choices, and the opposite is also true: If you eat poorly, then chances are you’ll sleep poorly. [2] And if you sleep poorly, you’ll be more likely to make bad choices when it comes to food. [4]

Stubbs says this all comes down to your circadian rhythm.

“Every single cell in our body works on a circadian clock, meaning it has phases for specific functions that are entrained with our sleep and wake cycles,” she explains. “The goal of the circadian rhythm is to keep the body in balance. If we are following a regulated pattern, our body is constantly working to get back in balance.”

When you sleep well, you’re more likely to make healthy food choices, and the opposite is also true: If you eat poorly, then chances are you’ll sleep poorly. And if you sleep poorly, you’ll be more likely to make bad choices when it comes to food.

Eating too close to bedtime is one way food can affect circadian rhythm. [2, 5]

“Eating any kind of food too close to bedtime, when the lights start to dim and our cells are ready to shift to the restorative portion of the cycle, throws off their pattern and is detrimental to their function and ultimately our overall health,” Stubbs says.

Nutrition can also impact the restoration that’s needed during sleep, which replenishes your body’s energy stores and repairs damage. “We can’t enter this portion cycle if we are still breaking down and metabolizing food,” Stubbs explains.

What you eat is also important.

First, different types of food can affect the major hormone transmitters in the body responsible for maintaining circadian rhythms and homeostasis, or “a normal balance within the body,” says Stubbs. [6]

Adequate nutrients can also act as building blocks for falling asleep and achieving good-quality sleep. We’ll get into this in a bit, but some of the key nutrients for healthy sleep are calcium, magnesium, potassium, and B vitamins.

Fiber plays an especially important role in nutrition and sleep. Fiber from plant foods is the fuel for healthy gut microbes.

A 2016 study published in the Journal of Clinical Sleep Medicine found that consuming foods low in fiber and high in saturated fat and sugar is associated with lighter, less restorative sleep. [7]

“More and more studies have shown the important role these microbes play in sleep and overall health,” shares Stubbs. For example, they produce serotonin, the precursor to melatonin. [8] “The proper amount of serotonin is essential to quality sleep,” says Stubbs. “Fiber also reduces inflammation, which improves sleep.” [9]

Protein is another crucial aspect of nutrition for improved sleep quality, particularly plant-based protein. According to 2024 research, plant-based proteins were linked to better quality sleep over animal protein. [10]

Watch this video for late-night snack ideas that can help you sleep:

What’s the best diet for sleep?

To achieve ideal sleep, there are certain foods you should always aim to consume in your diet.

“In my opinion, a plant-based diet rich in fiber from fruits, vegetables, whole grains, sources of omega-3, like algae, walnuts, chia, and flaxseed, and vitamin D, like algae or a supplement, is optimal for promoting sleep quality and duration,” Stubbs says. [10]

Adding probiotic strains to your gut through fermented foods like kefir, kimchi, sauerkraut, kombucha, and miso can also provide microbiome-boosting effects for your gut that reduce inflammation and promote mood and sleep through the production of serotonin, she adds. [11]

Let’s take a closer look at the nutritional essentials for a good night’s sleep:

Melatonin

Melatonin is available as a supplement, but it’s also found in food. A diet that includes foods rich in melatonin can help you get a better night’s sleep without worrying about the safety or efficacy of supplements. [12]

Melatonin-containing foods provide a host of other health benefits, such as increased antioxidant and anti-inflammatory activity, cardiovascular protection, and enhanced immune function. [12]

Sources of dietary melatonin include nuts (almonds, pistachios, walnuts); fruits and berries (cherries, grapes, raspberries, strawberries); tomatoes; peppers; and wine.

Calcium

Calcium helps the brain produce and use the amino acid tryptophan to manufacture melatonin. Several studies have linked calcium deficiency to difficulty falling asleep. [13]

Calcium works with magnesium to relax muscles. [14, 15] Good natural sources of calcium are dairy (milk, cheese, yogurt); citrus fruits; dark leafy greens (collards, kale, and others); nuts; soy; and fish like sardines and salmon.

Magnesium

Magnesium is a natural relaxant and an essential mineral for sleep function. [16] It helps maintain healthy levels of GABA (gamma-aminobutyric acid), a neurotransmitter that promotes relaxation. [17] Magnesium deficiency is common and linked to insomnia and restless legs syndrome. [16, 18]

Magnesium-rich foods include nuts and seeds (almonds, cashews, sunflower seeds, pumpkin seeds), bananas, avocados, spinach, broccoli, peas, beets, beans, and soybeans.

Potassium

Potassium increases sleep efficiency, improves overall sleep quality, and reduces episodes of waking after sleep onset. [19] A lack of potassium can lead to difficulty staying asleep. [20]

Potassium-rich foods include bananas, carrot juice, prune juice, lima beans, white beans, potatoes, salmon, tuna, and spinach.

Tryptophan

Tryptophan is an amino acid that helps your body make serotonin, a hormone associated with relaxation that is required to make melatonin. [21]

Tryptophan has been shown to be effective in reducing sleep onset time—perhaps the reason why it’s most commonly associated with post-Thanksgiving dinner food coma. [22]

A study in the American Journal of Clinical Nutrition indicated that participants who ate tryptophan-rich foods suffered less daytime sleepiness and enjoyed sustained alertness early in the morning, most likely due to improved nighttime sleep. [23]

Foods rich in tryptophan include lean beef, poultry, shellfish, and other fish like tuna and halibut; eggs; pumpkin seeds and sesame seeds; soybeans, white beans, and chickpeas; cheddar cheese; chocolate; and dates.

Vitamin B6, vitamin D, and zinc

Vitamin B6, contained in many of the above foods, also helps convert tryptophan into melatonin. [24] A B6 deficiency is linked to lowered serotonin levels and poor sleep, as well as mood disorders and depression—all of which can lead to insomnia. [25]

Additionally, Vitamin B6 supports dream recall. [26] Foods with vitamin B6 include chickpeas, tuna, salmon, and chicken breast.

Vitamin D, too, may also play a role in sleep, as might the mineral zinc. In one study it was found that zinc, along with melatonin and magnesium, improves sleep quality for those who suffer from insomnia. [27]

You can find vitamin D in cod liver oil, trout, salmon, mushrooms, and fortified items like milk and breakfast cereal. Oysters, meanwhile, are high in zinc.

Omega-3s

Omega-3 fatty acids are linked to sleep quality because they boost the sleep-promoting effects of melatonin. [28] Additionally, a Journal of Sleep Research study linked omega-3 fatty acids to improved sleep in children. [29]

Omega-3s are found in fish (particularly fatty fish like salmon and tuna), nuts and seeds, plant oils, and fortified foods like eggs and yogurt.

What foods interfere with sleep?

Some foods aren’t so helpful for sleep. In fact, they can make it very difficult to get a good night’s sleep. These include caffeine, alcohol, high-fat foods, and spicy foods.

Stubbs points to studies confirming these detrimental foods. One double-blind study shows caffeine consumption decreases both sleep time and sleep quality. [30]

Saturated fat, the form of fat rich in animal foods, has also been associated with decreased sleep quality. [31] Another study shows red meat significantly decreases the secretion of urinary melatonin, also needed for sleep. [32]

Lastly, alcohol can decrease the amount of melatonin in your body, which can cause difficulty sleeping. [33]

FAQs

How does nutrition affect sleep?

“You are what you eat” has never been truer when it comes to sleep. It can directly impact your circadian rhythm, the internal process that controls the sleep-wake cycle.

What nutrients disrupt sleep?

According to Stubbs, foods that are high in fat or contain caffeine or meals that include red meat or alcohol can greatly disturb sleep. Additionally, spicy foods aren’t the best for sleep since they can bring on acid reflux.

What nutrition helps sleep?

Stubbs encourages eating these foods to accomplish better sleep:

  • Plant-based foods rich in fiber, like fruits, vegetables, and whole grains
  • Sources of omega-3, like algae, walnuts, chia, and flaxseed
  • Sources of vitamin D, like algae or a supplement
  • Probiotic strains found in fermented foods like kefir, kimchi, sauerkraut, kombucha, and miso

Can poor nutrition cause insomnia?

Poor nutrition can absolutely lead to sleep problems, such as insomnia. Stubbs says you need good nutrition to help promote sleep. “Essential amino acids and fatty acids are important cofactors for the production of neurotransmitters that affect sleep,” she says.

H20 also plays a key role in sleep quality. Here’s how drinking more water can improve your sleep.

References

  1. Colrain, I. M., Nicholas, C. L., & Baker, F. C. (2014). Alcohol and the Sleeping Brain. Handbook of Clinical Neurology, 125, 415. https://doi.org/10.1016/B978-0-444-62619-6.00024-0
  2. Drake, C., Roehrs, T., Shambroom, J., Roth, T. (2013). Journal of Clinical Sleep Medicine. Caffeine Effects on Sleep Taken 0, 3, or 6 Hours before Going to Bed, 9(11). https://doi.org/10.5664/jcsm.3170
  3. Pattnaik, H., Mir, M., Boike, S., Kashyap, R., Khan, S. A., & Surani, S. (2022). Nutritional Elements in Sleep. Cureus, 14(12). https://doi.org/10.7759/cureus.32803
  4. Binks, H., Vincent, G. E., Gupta, C., Irwin, C., & Khalesi, S. (2020). Effects of Diet on Sleep: A Narrative Review. Nutrients, 12(4). https://doi.org/10.3390/nu12040936
  5. Greer, S. M., Goldstein, A. N., & Walker, M. P. (2013). The impact of sleep deprivation on food desire in the human brain. Nature Communications, 4, 2259. https://doi.org/10.1038/ncomms3259
  6. Cleveland Clinic. Is Eating Before Bed Bad for You? https://health.clevelandclinic.org/is-eating-before-bed-bad-for-you
  7. Zhao, M., Tuo, H., Wang, S., & Zhao, L. (2020). The Effects of Dietary Nutrition on Sleep and Sleep Disorders. Mediators of Inflammation, 2020. https://doi.org/10.1155/2020/3142874
  8. St-Onge, M.P., Roberts, A., Shechter, A., & Choudhury, A. R. (2016). Fiber and saturated fat are associated with sleep arousals and slow wave sleep. Journal of Clinical Sleep Medicine, 12(01), 19–24. https://doi.org/10.5664/jcsm.5384
  9. Erland, A. E., & Saxena, P. K. Melatonin Natural Health Products and Supplements: Presence of Serotonin and Significant Variability of Melatonin Content. Journal of Clinical Sleep Medicine: JCSM: Official Publication of the American Academy of Sleep Medicine, 13(2), 275-281. https://doi.org/10.5664/jcsm.6462
  10. Wirth, M. D., Jessup, A., Turner-McGrievy, G., Shivappa, N., Hurley, T. G., & Hébert, J. R. (2020). Changes in dietary inflammatory potential predict changes in sleep quality metrics, but not sleep duration. Sleep, 43(11). https://doi.org/10.1093/sleep/zsaa093
  11. Wirth, J., Lin, K., Brennan, L., Wu, K., & Giovannucci, E. (2024). Protein intake and its association with sleep quality: Results from 3 prospective cohort studies. European Journal of Clinical Nutrition, 78(5), 413-419. https://doi.org/10.1038/s41430-024-01414-y
  12. Wastyk, H. C., Fragiadakis, G. K., Perelman, D., Dahan, D., Merrill, B. D., Yu, F. B., Topf, M., Gonzalez, C. G., Van Treuren, W., Han, S., Robinson, J. L., Elias, J. E., Sonnenburg, E. D., Gardner, C. D., & Sonnenburg, J. L. (2021). Gut-microbiota-targeted diets modulate human immune status. Cell, 184(16). https://doi.org/10.1016/j.cell.2021.06.019
  13. Meng, X., Li, Y., Li, S., Zhou, Y., Gan, Y., Xu, P., & Li, B. (2017). Dietary Sources and Bioactivities of Melatonin. Nutrients, 9(4). https://doi.org/10.3390/nu9040367
  14. Jeon, S., Yu, S., Kim, C., Lee, H. J., Yoon, Y., & Kim, T. (2022). Lower Serum Calcium Levels Associated with Disrupted Sleep and Rest–Activity Rhythm in Shift Workers. Nutrients, 14(15). https://doi.org/10.3390/nu14153021
  15. Remondi Souza, A. C., Vasconcelos, A. R., Dias, D. D., Komoni, G., & Name, J. J. (2023). The Integral Role of Magnesium in Muscle Integrity and Aging: A Comprehensive Review. Nutrients, 15(24). https://doi.org/10.3390/nu15245127
  16. Potter, J. D., Robertson, S. P., & Johnson, J. D. (1981). Magnesium and the regulation of muscle contraction. Federation proceedings, 40(12), 2653–2656.
  17. Abbasi, B., Kimiagar, M., Sadeghniiat, K., Shirazi, M. M., Hedayati, M., & Rashidkhani, B. (2012). The effect of magnesium supplementation on primary insomnia in elderly: A double-blind placebo-controlled clinical trial. Journal of Research in Medical Sciences: the official journal of Isfahan University of Medical Sciences, 17(12), 1161–1169.
  18. Pickering, G., Mazur, A., Trousselard, M., Bienkowski, P., Yaltsewa, N., Amessou, M., Noah, L., & Pouteau, E. (2020). Magnesium Status and Stress: The Vicious Circle Concept Revisited. Nutrients, 12(12). https://doi.org/10.3390/nu12123672
  19. Gorantla, S., Ravisankar, A., & Trotti, L. M. (2024). Magnesium citrate monotherapy improves restless legs syndrome symptoms and multiple suggested immobilization test scores in an open-label pilot study. Journal of Clinical Sleep Medicine, 20(8), 1357–1361. https://doi.org/10.5664/jcsm.11206
  20. Drennan, M. D., Kripke, D. F., Klemfuss, H. A., & Moore, J. D. (1991). Potassium affects actigraph-identified sleep. Sleep, 14(4), 357–360.
  21. Heizhati, M., Zhang, Y., Shao, L., Wang, Y., Yao, X., Abulikemu, S., Zhang, D., Chang, G., Zhou, L., & Li, N. (2019). Decreased serum potassium may disturb sleep homeostasis in essential hypertensives. Hypertension Research, 42(2), 174-181. https://doi.org/10.1038/s41440-018-0131-4
  22. Jenkins, T. A., D. Nguyen, J. C., Polglaze, K. E., & Bertrand, P. P. (2016). Influence of Tryptophan and Serotonin on Mood and Cognition with a Possible Role of the Gut-Brain Axis. Nutrients, 8(1). https://doi.org/10.3390/nu8010056
  23. Bravo, R., Matito, S., Cubero, J., Paredes, S. D., Franco, L., Rivero, M., Rodríguez, A. B., & Barriga, C. (2013). Tryptophan-enriched cereal intake improves nocturnal sleep, melatonin, serotonin, and total antioxidant capacity levels and mood in elderly humans. Age (Dordrecht, Netherlands), 35(4), 1277–1285. https://doi.org/10.1007/s11357-012-9419-5
  24. Markus, C. R., Jonkman, L. M., Lammers, J. H., Deutz, N. E., Messer, M. H., & Rigtering, N. (2005). Evening intake of α-lactalbumin increases plasma tryptophan availability and improves morning alertness and brain measures of attention. The American Journal of Clinical Nutrition, 81(5), 1026–1033. https://doi.org/10.1093/ajcn/81.5.1026
  25. Picone, S., Ariganello, P., Mondì, V. et al. A solution based on melatonin, tryptophan, and vitamin B6 (Melamil Tripto©) for sedation in newborns during brain MRI. Ital J Pediatr 45, 122 (2019). https://doi.org/10.1186/s13052-019-0714-y
  26. Ge, L., Luo, J., Zhang, L., Kang, X., & Zhang, D. (2022). Association of Pyridoxal 5′-Phosphate with Sleep-Related Problems in a General Population. Nutrients, 14(17). https://doi.org/10.3390/nu14173516
  27. Adventure-Heart, D. J., Madden, N. A., & Delfabbro, P. (2018). Effects of Vitamin B6 (Pyridoxine) and a B Complex Preparation on Dreaming and Sleep. Perceptual and Motor Skills. https://doi.org/10.1177/0031512518770326
  28. Rondanelli, M., Opizzi, A., Monteferrario, F., Antoniello, N., Manni, R., & Klersy, C. (2011). The effect of melatonin, magnesium, and zinc on primary insomnia in long-term care facility residents in Italy: a double-blind, placebo-controlled clinical trial. Journal of the American Geriatrics Society, 59(1), 82–90. https://doi.org/10.1111/j.1532-5415.2010.03232.x
  29. Dauchy, E. M., Dauchy, R. T., Tirrell, R. P., Davidson, L. K., Hill, S. M., Sauer, L. A., & Blask, D. E. (2021). Dietary Melatonin and Omega-3 Fatty Acids Induce Human Cancer Xenograft Regression In Vivo in Rats by Suppressing Linoleic Acid Uptake and Metabolism. Comparative Medicine, 71(4), 309-317. https://doi.org/10.30802/AALAS-CM-21-000025
  30. Montgomery, P., Burton, J. R., Sewell, R. P., Spreckelsen, T. F., & Richardson, A. J. (2014). Fatty acids and sleep in UK children: Subjective and pilot objective sleep results from the DOLAB study – a randomized controlled trial. Journal of Sleep Research, 23(4), 364-388. https://doi.org/10.1111/jsr.12135
  31. Shilo, L., Sabbah, H., Hadari, R., Kovatz, S., Weinberg, U., Dolev, S., Dagan, Y., & Shenkman, L. (2002). The effects of coffee consumption on sleep and melatonin secretion. Sleep medicine, 3(3), 271–273. https://doi.org/10.1016/s1389-9457(02)00015-1
  32. St-Onge, P., Roberts, A., Shechter, A., & Choudhury, A. R. Fiber and Saturated Fat Are Associated with Sleep Arousals and Slow Wave Sleep. Journal of Clinical Sleep Medicine : JCSM : Official Publication of the American Academy of Sleep Medicine, 12(1), 19-24. https://doi.org/10.5664/jcsm.5384
  33. Schernhammer, E. S., Feskanich, D., Niu, C., Dopfel, R., Holmes, M. D., & Hankinson, S. E. (2009). Dietary correlates of urinary 6-sulfatoxymelatonin concentrations in the Nurses’ Health Study cohorts. The American Journal of Clinical Nutrition, 90(4), 975-985. https://doi.org/10.3945/ajcn.2009.27826

Was This Article Helpful?
Yes No

Related Stories