Most of us know that eating a heavy meal before bed can disrupt sleep. Changing what we eat and when we eat can help improve sleep quality.
We’ve all experienced waking up the next morning feeling energized after a heavy dinner. The extra energy required to digest a large, rich meal can disrupt sleep and lead to restorative sleep.
Luckily, we can review certain foods and drinks that promote wakefulness (such as caffeinated beverages) to improve sleep. But are there certain foods—especially those consumed close to bed—that can further enhance sleep quality?
Is it a single food or a whole diet that’s effective?
Several studies have found that certain dinner foods may improve sleep. For example, a small trial found that tart cherry juice can help with sleep; another study suggests that eating kiwi fruit before bed is also beneficial; and yet another study suggests that warm milk can help with falling asleep. Milk is known to contain a large amount of tryptophan, which the body uses to synthesize the sleep hormone melatonin, which promotes sleep.
Melatonin regulates our sleep-wake cycle. Our bodies begin to produce more melatonin in the evening, but we can also get it directly through foods such as eggs, fish, nuts, and seeds.

Studies have found that cherry juice can help improve sleep.
Many studies have found that consuming foods rich in melatonin can improve sleep quality and duration. However, numerous studies have also pointed out that no single food or drink is sufficient to improve sleep; the overall diet is crucial.
Marie-Pierre St-Onge, professor of nutritional medicine at Columbia University’s Institute of Human Nutrition, says, “You can’t eat poorly all day and then drink a glass of tart cherry juice before bed to improve your sleep.”
She points out that it takes time for the body to extract nutrients from food to produce sleep-promoting neurochemicals. Therefore, your diet throughout the day is the key factor influencing your sleep quality.
What diet is best for sleep?
Erica Jansen, assistant professor of nutritional science at the University of Michigan, said research shows that the most beneficial diet for sleep is a plant-based one that includes plenty of whole grains, dairy, and lean protein (such as fish).
In a 2021 study, Jansen found that participants who increased their daily fruit and vegetable intake over three months experienced significant improvements in sleep quality.
Over 1,000 participants were asked to increase their daily fruit and vegetable intake to clarify the bidirectional relationship between sleep and diet. While population studies have shown that people who eat a healthier diet sleep better, it’s possible that better sleep leads to healthier dietary choices.
Janssen found that women who increased their intake of fruit and vegetables by three or more servings per day were more than twice as likely to experience improvements in their insomnia symptoms.
One reason for this is that fruits and vegetables (as well as meat, dairy products, nuts, seeds, whole grains, and legumes) are generally rich in tryptophan.
A 2024 Spanish study investigated the sleep habits and diet of over 11,000 students and found that those with the lowest tryptophan intake had the worst sleep quality. Researchers believe that low tryptophan intake is associated with short sleep duration and an increased risk of insomnia, and recommend increasing the intake of foods rich in tryptophan to improve sleep.
Johnson points out that tryptophan is a precursor to serotonin, which is converted into melatonin.

Johnson points out that tryptophan is a precursor to serotonin, which is converted into melatonin.
“If the body lacks tryptophan or direct melatonin sources in food, melatonin production decreases,” she says.
However, she adds that tryptophan foods need to be paired with high-fiber carbohydrates (such as whole grains or legumes) for efficient digestion and absorption into the brain, thereby improving sleep.
Plant-based diets can also improve sleep in other ways. For example, a diet high in plant foods can reduce inflammation in the body, and studies have linked lower inflammation levels to better sleep quality.
Saint-Ange’s research also found that a high-fiber diet is associated with improved sleep because fiber ferments in the intestines, benefiting the gut microbiome. Studies suggest that a healthy gut can improve sleep through the gut-brain axis.
Animal studies have also shown that consuming plant compounds called polyphenols is associated with improved sleep. However, Saint-Ange noted that human studies are difficult to assess because polyphenol content in food is affected by crops, soil, climate, and agricultural practices, making the data inaccurate. Melatonin content in plant foods also varies depending on where they are grown and how they are cultivated.
Does magnesium help?
Magnesium is another sleep-promoting nutrient in a plant-based diet because it calms the nervous system by lowering the stress hormone cortisol.
The recommended daily intake for adults over 30 is about 420 mg of magnesium. Green leafy vegetables (such as spinach), beans, nuts, seeds, and whole grains are all rich sources of magnesium.

When you choose to eat also plays a role in the quality of your sleep.
Yet, many people are magnesium deficient. Experts say this is partly due to the Western diet, which is low in plant matter and high in processed foods, and partly because intensive agriculture reduces magnesium levels in the soil.
In a 2024 study, Heather Hausenblas, a professor of exercise science at Jacksonville University in Florida, tested the effects of increasing magnesium intake on people with poor sleep.
Participants took magnesium supplements one hour before bed for two weeks and a placebo for another two weeks. The study measured sleep using a wearable device and recorded participants’ subjective experiences.
The results showed that magnesium supplementation improved both deep sleep and rapid eye movement (REM) sleep. Hausenblass suggests this effect may persist beyond two weeks, but the results are uncertain.
She says that a high-quality magnesium supplement may help improve sleep, but it’s not a panacea.
“If you’re inactive, eat a lot of processed foods, and have an irregular sleep schedule, taking a magnesium supplement before bed won’t solve all your sleep problems,” she says.
Another reason magnesium improves sleep may be its benefits for mental health. Studies have linked poor sleep to depression.
A 2017 study found that daily magnesium supplementation significantly improved depression and anxiety symptoms, regardless of age, gender, or depression level.
More extensive research also suggests that a diet high in fruits and vegetables can improve depressive symptoms.
Does diet also have an impact?
While researchers agree that a single dinner food isn’t enough to improve sleep, we can adjust our daily eating schedules.
“It’s important to stop eating a few hours before bedtime, especially to avoid consuming the most calories right before bed,” says Jensen.
A small number of studies have linked early breakfasts and earlier meals to better sleep quality. Studies have also shown that eating dinner before bedtime can delay falling asleep. Jensen suggests this may be because clearly separating eating from the day and sleeping from the night helps the brain recognize when to sleep.
“When there’s a clear distinction between day and night, it’s easier for the brain to recognize when to sleep. The brain resets each morning, and morning light helps reset the body’s internal clock,” she says.
“Mealtimes are also a way of telling the body what time it is. The body functions best when it does the same things at the same time every day.”

Some studies have shown that melatonin supplements can help improve sleep, but we can also get melatonin from food.
Furthermore, one study found that eating a dairy-rich breakfast in bright daylight was more conducive to sleep than eating it in dim light. Researchers believe that eating in daylight boosts melatonin production, which helps with nighttime sleep.
However, Saint-Ange noted that the evidence remains unclear as to whether melatonin in plant foods affects the body’s own melatonin production and, in turn, affects sleep.
“We still need to delve deeper into whether diet affects metabolism, which could be related to sleep,” she says.
Janssen agrees that this is a difficult area of research, with many unanswered questions, including how much dietary melatonin we need to affect sleep.
“It’s difficult to study whether light exposure affects melatonin more than diet, or whether the two act together,” she says.
How to optimize diet for better sleep?
It seems that for a variety of reasons, a plant-based diet is most beneficial for sleep; and for those who can manage this, a consistent eating schedule can also help.
But diet isn’t isolated; researchers emphasize that sleep is also influenced by daytime activity, mental health, and exposure to light and darkness.
Furthermore, Saint-Ange points out the importance of distinguishing between general poor sleep and sleep disorders (such as insomnia or sleep apnea).
“If you have a sleep disorder, get tested and treated,” she said. “Improving your diet may be part of treatment, but some people need other approaches.”
