Short answer: The clearest effects come from avoiding caffeine within six hours of bed, alcohol and heavy or spicy late meals. A few foods helped in small studies: tart cherry juice raised melatonin and sleep time, and kiwifruit improved sleep in a study without a control group. Finish dinner two to three hours before bed and stop caffeine by early afternoon.

The clearest effects of diet on sleep come from what you cut: late caffeine, alcohol and heavy meals near bedtime clearly make sleep worse. Evidence that particular foods improve sleep is weaker, from small studies of tart cherries, kiwifruit and fish, plus observational links between a Mediterranean diet and better sleep.

Foods that may help you sleep

FoodWhat it containsEvidence
Tart cherry juiceMelatoninRaised melatonin and sleep time in a placebo-controlled trial of 20 adults (Howatson 2012)
Kiwifruit (two, one hour before bed)Serotonin, antioxidantsFaster sleep onset and longer sleep in 24 adults, no control group (Lin 2011)
Salmon three times a weekOmega-3, vitamin DBetter daily functioning than meat in one trial (Hansen 2014)
Walnuts, almondsMagnesium; walnuts contain a little melatoninWalnuts raised blood melatonin in rats (Reiter 2005)
Pumpkin seedsTryptophan, magnesiumOne of the most concentrated food sources of tryptophan
Leafy greens, legumes, avocado, dark chocolateMagnesiumMagnesium supplement trial in older adults with insomnia (Abbasi 2012)
Rice, sweet potato, whole grains at dinnerCarbohydrateHigh-GI rice four hours before bed shortened time to fall asleep in 12 men (Afaghi 2007)

Foods and drinks that disrupt sleep: coffee and other caffeine in the afternoon, alcohol, large high-fat meals and spicy food close to bedtime.

An evening eating plan

  1. Finish dinner two to three hours before bed. For a 10:30 PM bedtime, finish by 7:30 to 8:00 PM.
  2. Build dinner around a moderate portion of protein, such as poultry, fish, eggs, tofu or legumes. Add complex carbohydrates (sweet potato, brown rice, quinoa) and magnesium-rich vegetables (leafy greens, broccoli, edamame), dressed with olive oil.
  3. If you need a snack, keep it small and eat it about an hour before bed. Try a few walnuts or almonds, two kiwifruit, tart cherries, a banana with almond butter, or yogurt with pumpkin seeds.
  4. Stop caffeine by 1:00 to 2:00 PM. If afternoon coffee reliably disrupts your sleep, keep caffeine to the morning.
  5. Limit alcohol, especially within three hours of bed. If you drink, have one drink with dinner rather than after.
  6. Avoid heavy, fatty and spicy meals in the last three hours. If evening meals tend to be large, make lunch the big meal.
  7. Eat magnesium-rich foods through the day. If you consider a supplement, see the safety note below.

How food reaches the sleep system

Sleep runs in cycles of about 90 minutes. Deep sleep dominates the first half of the night and REM sleep, important for emotion and memory, the second half. Some dietary factors hit specific stages: alcohol disrupts REM later in the night, and caffeine reduces deep sleep.

The main chemical link is tryptophan, an amino acid in turkey, eggs, dairy, seeds and nuts. The brain turns it into serotonin and then melatonin, the hormone that signals night. Tryptophan competes with other amino acids to enter the brain, so a very high-protein meal can lower the share that gets in. Carbohydrates trigger insulin, which moves the competing amino acids into muscle. In theory, protein plus carbohydrate should get more tryptophan into the brain than protein alone. In a small study (Wurtman 2003), the plasma tryptophan ratio was higher after a carbohydrate-rich breakfast than after a protein-rich one, with a median difference of 54% in the 8 people who ate both. Sleep was not measured.

The conversion uses iron and vitamin B6. Severe deficiencies could in theory limit it, but this hasn’t been shown to affect sleep in people eating a normal diet. The process also takes several hours, which is one reason dinner timing matters.

The evidence for sleep-promoting foods

Tart cherries

Tart (Montmorency) cherries contain melatonin. Howatson (2012) ran a placebo-controlled crossover trial in 20 healthy adults. Seven days of tart cherry juice concentrate raised urinary melatonin and increased time in bed, total sleep and sleep efficiency.

In a pilot crossover study of eight adults over 50 with insomnia (Losso 2018), two weeks of tart cherry juice increased sleep time by 84 minutes compared with placebo. Sleep was measured in a sleep lab.

Kiwifruit

Lin (2011) asked 24 adults with sleep problems, 22 of them women, to eat two kiwifruit an hour before bed for four weeks. Afterwards they fell asleep 35% faster and slept 13% longer, with better sleep quality scores. There was no control group, so other factors could explain the change.

Fatty fish

Hansen (2014) randomized 95 male forensic psychiatric inpatients to Atlantic salmon or meat (chicken, pork or beef) three times a week from September to February. The fish group reported better daily functioning. The time to fall asleep got worse over the winter in the meat group but not in the fish group. Vitamin D and omega-3 are possible reasons, but these remain unproven.

Carbohydrates at dinner

Afaghi (2007) tested rice meals in 12 healthy young men. A high-GI meal eaten four hours before bed shortened the time to fall asleep (9 versus 17.5 minutes) compared with a low-GI meal. It also worked better than the same meal one hour before bed. No other sleep measures changed. This isn’t a reason to eat white rice before bed; a moderate portion of complex carbohydrates at a well-timed dinner is the sensible version.

What disrupts sleep

Caffeine

Caffeine blocks adenosine, a chemical that builds up while you’re awake and makes you sleepy. Its half-life is about five hours in healthy adults, so half the caffeine from a 3:00 PM coffee is still circulating at 8:00 PM. People with slow-metabolizing gene variants may have half-lives of eight hours or more.

Drake (2013) gave 400 mg of caffeine (about four cups of brewed coffee) at bedtime, three hours before or six hours before. All three disrupted sleep compared with placebo; even at six hours, total sleep fell by more than an hour. The authors advised avoiding caffeine for at least six hours before bed, longer for sensitive people. The upper intake for healthy adults is about 400 mg a day (200 mg in pregnancy). More in our caffeine and cognition guide.

Alcohol

Alcohol helps you fall asleep, which is why many people use it as a sleep aid. Ebrahim (2013) reviewed all known studies in healthy volunteers. At all doses, alcohol shortens the time to fall asleep and deepens the first half of the night. It then increases disruption in the second half, delays the first REM period and, at moderate and high doses, reduces total REM sleep.

Heavy and spicy meals

Fujiwara (2005) compared 147 people with reflux disease and 294 controls. Going to bed less than three hours after dinner was linked to about seven times the odds of reflux disease, compared with waiting four hours or more.

Falling asleep requires a drop in core body temperature, and spicy food can raise it. In six young men (Edwards 1992), mustard and Tabasco added to an evening meal increased time awake and reduced deep and stage 2 sleep. Body temperature rose in the first sleep cycle.

In 52 healthy adults (Crispim 2011), eating near bedtime, especially fat, was linked to taking longer to fall asleep and lower sleep efficiency, particularly in women. Going to bed very hungry can also make it harder to fall asleep.

Sugar and low fiber

St-Onge (2016) tracked 26 adults on a day of self-selected eating. More energy from sugar was linked to more awakenings, more saturated fat to less deep sleep and more fiber to more deep sleep. The authors said this pattern needs testing, and the mechanism is not known.

The Mediterranean diet and sleep

In a cross-sectional study of 172 middle-aged Italian adults (Muscogiuri 2020), good sleepers followed the Mediterranean diet more closely than poor sleepers. Campanini (2017) followed 1,596 Spanish adults aged 60 and over for about three years. The highest third of adherence had about 30% lower odds of developing several signs of poor sleep than the lowest third. Both are observational studies.

Magnesium

Magnesium dampens the brain’s main excitatory signals and has calming, GABA-like effects. About half of US adults consume less than the estimated average requirement, partly because refined foods contain little.

Abbasi (2012) ran a placebo-controlled trial in 46 older adults with insomnia. Taking 500 mg of magnesium daily for eight weeks improved insomnia severity, sleep time, sleep efficiency and time to fall asleep. The effect on early waking was not statistically significant. Blood melatonin rose and cortisol fell.

The 500 mg used is above the 350 mg a day upper limit for magnesium from supplements. Higher doses can cause diarrhea and should only be taken under medical supervision. People with kidney disease should not take magnesium supplements without medical advice. Magnesium can interact with some medicines, including certain antibiotics and osteoporosis drugs. Ask a doctor or pharmacist first, especially if you take other medication. Glycinate and threonate forms are often marketed for sleep, but there is little human evidence they work better; see magnesium threonate vs glycinate.

Poor sleep leads to poorer eating

The link runs both ways. After sleep deprivation (Greer 2013), brain scans showed less activity in frontal areas that weigh food choices and more in the amygdala, and people wanted more high-calorie foods.

In a crossover study of 30 adults (St-Onge 2011), people spent four nights with 4 hours in bed. On the fifth day they ate about 300 more calories than after 9-hour nights, mostly from fat. In 12 young men (Spiegel 2004), two nights of short sleep lowered the fullness hormone leptin by 18% and raised the hunger hormone ghrelin by 28%. Appetite for calorie-dense carbohydrates rose.

After a bad night, plan the next day’s meals in advance, keep tempting snacks out of reach and include protein and fiber at breakfast.

Frequently asked questions

Can melatonin supplements replace sleep-promoting foods?

Melatonin supplements can help with jet lag and shifting your body clock. They can interact with medicines such as blood thinners, sedatives and some diabetes and blood pressure drugs. Ask a doctor or pharmacist first, especially if you are pregnant or breastfeeding.

Does warm milk help you sleep?

Milk contains tryptophan, but only a modest amount, and controlled studies have not shown a reliable effect from milk alone. A warm drink can still be a useful bedtime cue.

How quickly will diet changes affect my sleep?

Caffeine and alcohol affect sleep the same night, so cutting them late in the day can help within days. In the trials above, tart cherry juice changed sleep within one to two weeks and kiwifruit within four weeks.

Does intermittent fasting affect sleep?

It depends on the window. Eating earlier in the day fits the body clock, but going to bed very hungry can make it harder to fall asleep, so include an evening meal or snack. Fasting is not safe for everyone: people taking insulin, sulfonylureas or SGLT2 inhibitors should only fast under medical supervision. It is not recommended for people with a history of eating disorders or who are pregnant or breastfeeding. Read more on meal timing and mental performance.

Sources

  • 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, 17(12), 1161-1169. PMID:23853635
  • Afaghi, A., O’Connor, H., & Chow, C. M. (2007). High-glycemic-index carbohydrate meals shorten sleep onset. American Journal of Clinical Nutrition, 85(2), 426-430. doi:10.1093/ajcn/85.2.426
  • Campanini, M. Z., Guallar-Castillón, P., Rodríguez-Artalejo, F., & Lopez-Garcia, E. (2017). Mediterranean diet and changes in sleep duration and indicators of sleep quality in older adults. Sleep, 40(3), zsw083. doi:10.1093/sleep/zsw083
  • Crispim, C. A., Zimberg, I. Z., dos Reis, B. G., Diniz, R. M., Tufik, S., & de Mello, M. T. (2011). Relationship between food intake and sleep pattern in healthy individuals. Journal of Clinical Sleep Medicine, 7(6), 659-664. doi:10.5664/jcsm.1476
  • Drake, C., Roehrs, T., Shambroom, J., & Roth, T. (2013). Caffeine effects on sleep taken 0, 3, or 6 hours before going to bed. Journal of Clinical Sleep Medicine, 9(11), 1195-1200. doi:10.5664/jcsm.3170
  • Ebrahim, I. O., Shapiro, C. M., Williams, A. J., & Fenwick, P. B. (2013). Alcohol and sleep I: effects on normal sleep. Alcoholism: Clinical and Experimental Research, 37(4), 539-549. doi:10.1111/acer.12006
  • Edwards, S. J., Montgomery, I. M., Colquhoun, E. Q., Jordan, J. E., & Clark, M. G. (1992). Spicy meal disturbs sleep: an effect of thermoregulation? International Journal of Psychophysiology, 13(2), 97-100. doi:10.1016/0167-8760(92)90048-g
  • Fujiwara, Y., Machida, A., Watanabe, Y., Shiba, M., Tominaga, K., Watanabe, T., et al. (2005). Association between dinner-to-bed time and gastro-esophageal reflux disease. American Journal of Gastroenterology, 100(12), 2633-2636. doi:10.1111/j.1572-0241.2005.00354.x
  • 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. doi:10.1038/ncomms3259
  • Hansen, A. L., Dahl, L., Olson, G., Thornton, D., Graff, I. E., Frøyland, L., Thayer, J. F., & Pallesen, S. (2014). Fish consumption, sleep, daily functioning, and heart rate variability. Journal of Clinical Sleep Medicine, 10(5), 567-575. doi:10.5664/jcsm.3714
  • Howatson, G., Bell, P. G., Tallent, J., Middleton, B., McHugh, M. P., & Ellis, J. (2012). Effect of tart cherry juice (Prunus cerasus) on melatonin levels and enhanced sleep quality. European Journal of Nutrition, 51(8), 909-916. doi:10.1007/s00394-011-0263-7
  • Lin, H. H., Tsai, P. S., Fang, S. C., & Liu, J. F. (2011). Effect of kiwifruit consumption on sleep quality in adults with sleep problems. Asia Pacific Journal of Clinical Nutrition, 20(2), 169-174. PMID:21669584
  • Losso, J. N., Finley, J. W., Karki, N., Liu, A. G., Prudente, A., Tipton, R., Yu, Y., & Greenway, F. L. (2018). Pilot study of the tart cherry juice for the treatment of insomnia and investigation of mechanisms. American Journal of Therapeutics, 25(2), e194-e201. doi:10.1097/MJT.0000000000000584
  • Muscogiuri, G., Barrea, L., Aprano, S., Framondi, L., Di Matteo, R., Laudisio, D., et al. (2020). Sleep quality in obesity: does adherence to the Mediterranean diet matter? Nutrients, 12(5), 1364. doi:10.3390/nu12051364
  • Reiter, R. J., Manchester, L. C., & Tan, D. X. (2005). Melatonin in walnuts: influence on levels of melatonin and total antioxidant capacity of blood. Nutrition, 21(9), 920-924. doi:10.1016/j.nut.2005.02.005
  • Spiegel, K., Tasali, E., Penev, P., & Van Cauter, E. (2004). Brief communication: sleep curtailment in healthy young men is associated with decreased leptin levels, elevated ghrelin levels, and increased hunger and appetite. Annals of Internal Medicine, 141(11), 846-850. doi:10.7326/0003-4819-141-11-200412070-00008
  • St-Onge, M. P., Roberts, A. L., Chen, J., Kelleman, M., O’Keeffe, M., RoyChoudhury, A., & Jones, P. J. (2011). Short sleep duration increases energy intakes but does not change energy expenditure in normal-weight individuals. American Journal of Clinical Nutrition, 94(2), 410-416. doi:10.3945/ajcn.111.013904
  • 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(1), 19-24. doi:10.5664/jcsm.5384
  • Wurtman, R. J., Wurtman, J. J., Regan, M. M., McDermott, J. M., Tsay, R. H., & Breu, J. J. (2003). Effects of normal meals rich in carbohydrates or proteins on plasma tryptophan and tyrosine ratios. American Journal of Clinical Nutrition, 77(1), 128-132. doi:10.1093/ajcn/77.1.128