What to Eat for Better Sleep: Top Foods and Timing

Certain foods genuinely help you sleep better, and the reason comes down to a few key nutrients: tryptophan, melatonin, magnesium, and omega-3 fatty acids. These aren’t vague wellness claims. Each one plays a measurable role in the chemical process your brain uses to wind down at night. The foods that contain them, how much you eat, and when you eat them all matter.

How Food Becomes Sleep

Your body manufactures its own sleep hormone, melatonin, but it can’t do it from scratch. The process starts with tryptophan, an amino acid you can only get from food. Your brain converts tryptophan into serotonin, then converts serotonin into melatonin through a two-step chemical modification. This entire chain depends on having enough raw material from your diet, which is why what you eat in the evening can directly influence how quickly you fall asleep and how long you stay there.

Tart Cherry Juice

Tart cherries are one of the few foods that contain meaningful amounts of melatonin on their own, which means they bypass part of that conversion chain entirely. In a pilot study published in the American Journal of Therapeutics, people with insomnia who drank 240 ml (about 8 ounces) of tart cherry juice twice a day for two weeks increased their total sleep time by 84 minutes compared to placebo. That’s a striking number for a dietary change alone.

The protocol in that study was simple: one glass in the morning and one glass one to two hours before bed. Tart cherry juice also contains compounds called procyanidins that may slow the breakdown of tryptophan in the body, giving your brain more raw material to work with. Look for 100% tart cherry juice (not cherry-flavored blends), and keep in mind that it’s fairly tart on its own.

Kiwifruit

Kiwis pack an unusual combination of nutrients relevant to sleep. Each gram of kiwifruit contains about 24 micrograms of melatonin and 5.8 micrograms of serotonin, both of which directly support your brain’s sleep signaling. They’re also dense in antioxidants, which may reduce inflammation that interferes with sleep quality.

Research on people eating two kiwis an hour before bed found that self-reported time to fall asleep dropped by 35.4%, time spent awake in the middle of the night dropped by 28.9%, and overall sleep efficiency improved by 5.4%. These are meaningful shifts for something as low-effort as eating two pieces of fruit before bed. Kiwis are also low in calories, so they won’t leave you feeling overly full at night.

Walnuts

Walnuts contain both tryptophan and melatonin, making them a two-for-one sleep food. A randomized crossover trial of 76 young adults found that eating 40 grams of walnuts (roughly a small handful) at dinner for eight weeks significantly increased evening melatonin levels, reduced the time it took to fall asleep, and improved overall sleep quality. The researchers measured melatonin through urine samples collected between 8 p.m. and 7 a.m. and confirmed the increase was consistent.

Forty grams is a modest portion, about a quarter cup. Adding them to a salad, grain bowl, or evening snack is an easy way to work them in.

Fatty Fish

Salmon, mackerel, sardines, and other fatty fish are rich in omega-3 fatty acids, specifically DHA and EPA. A randomized, double-blinded trial gave healthy middle-aged and older adults omega-3 capsules (576 mg DHA and 284 mg EPA per day) for 12 weeks and found that sleep efficiency improved compared to the placebo group. Participants also reported fewer issues with disruptive dreaming.

Fatty fish also provides vitamin D, which independently influences sleep-regulating pathways in the brain. Most people don’t get enough vitamin D from diet alone, so fish serves double duty here. Two to three servings per week is a reasonable target that aligns with broader nutritional guidelines.

Magnesium-Rich Foods

Magnesium helps your nervous system calm down by binding to GABA receptors in the brain. GABA is your body’s primary “slow down” signal, reducing the excitability of nerve cells. When magnesium levels are low, this braking system doesn’t work as effectively, and falling asleep becomes harder.

Clinical trial data shows that supplementing with 500 mg of elemental magnesium daily for eight weeks significantly increased sleep duration and decreased the time it took to fall asleep in older adults. You don’t necessarily need a supplement to get there. Dark leafy greens, pumpkin seeds, almonds, black beans, and dark chocolate are all concentrated sources. A cup of cooked spinach delivers around 150 mg, and an ounce of pumpkin seeds provides about 160 mg. Building these into your evening meals can make a real difference over time.

The Timing of Your Last Meal

What you eat matters, but when you eat it matters too, particularly for carbohydrates. A study comparing high-glycemic-index carbohydrates (foods that spike blood sugar quickly, like white rice or jasmine rice) to low-glycemic-index carbs found that the high-GI meal cut the time to fall asleep nearly in half: 9 minutes versus 17.5 minutes. The catch was timing. The high-GI meal only worked this well when eaten four hours before bed. The same meal eaten just one hour before bed was significantly less effective, with sleep onset latency climbing back up to about 14.6 minutes.

The likely explanation is that tryptophan competes with other amino acids to cross into the brain. A spike in blood sugar triggers insulin, which clears those competing amino acids from the bloodstream and gives tryptophan a clearer path. That process takes a few hours to play out. So if you’re eating a carb-heavy dinner, earlier is better for sleep purposes.

Interestingly, a separate study on healthy volunteers found that shifting dinner from five hours before bed to just one hour before bed didn’t significantly worsen sleep architecture on its own. The takeaway isn’t that late eating is catastrophic. It’s that earlier meals give sleep-promoting nutrients more time to do their work, especially when those meals contain high-GI carbohydrates.

What to Limit in the Evening

Caffeine has a half-life that ranges from 2 to 12 hours depending on your genetics and metabolism. For most people, the recommended cutoff is at least eight hours before bedtime. If you go to sleep at 11 p.m., that means no coffee, tea, or energy drinks after 3 p.m. Even if you feel like caffeine doesn’t affect you, it can reduce the amount of deep sleep you get without making you feel obviously awake.

Fluid intake also deserves attention. Drinking more than 500 ml (about 17 ounces) within two hours of bedtime is associated with reduced sleep efficiency, more nighttime awakenings, and lower alertness the next morning. Moderate intake between 250 and 500 ml in that same window showed no significant sleep impairment. You don’t need to go to bed thirsty. Just avoid large glasses of water, herbal tea, or other beverages right before bed. Sip enough to stay comfortable without overloading your bladder.

Putting It Together

A sleep-friendly evening eating pattern might look like this: a dinner built around fatty fish or another protein source, paired with a serving of leafy greens or beans for magnesium and a side of white or jasmine rice, eaten about four hours before bed. A handful of walnuts or two kiwis as an evening snack, finished one to two hours before sleep. Tart cherry juice, if you enjoy it, with your snack. Caffeine stops by early afternoon, and you keep fluids moderate in the last two hours of the night.

None of these foods are a cure for serious sleep disorders, but the research consistently shows that they move the needle on how quickly you fall asleep, how long you stay asleep, and how restorative that sleep is. The effects are cumulative, meaning consistency over weeks matters more than any single meal.