What to eat for good sleep — during the day or before bed

by Kaiser Permanente |
Person smiling as they sleep

Getting enough sleep is an important part of a healthy lifestyle. It can keep your immune system strong, improve your mood, and help you feel less stressed. Yet 1 in 3 adults don’t get the recommended amount of sleep.1 And during times of personal or professional stress, it can be even harder to sleep well.

If you’re struggling to sleep through the night, one good first step is to look at your diet. Certain foods can help you sleep better. And you may already have some of them in your kitchen. So, what can you eat to set yourself up for a good night’s rest?

3 foods to help with sleep

In general, it’s best to eat a healthy diet full of fruits and vegetables, lean protein, and whole grains. Having a balanced diet can help with your overall health, including your sleep. Here are 3 foods that are easy to add to your diet to help you sleep better.

Nuts

Not only are many nuts high in heart-healthy fat, but some also have the hormone melatonin.2 Melatonin helps regulate your sleep-wake cycle.

Nuts with naturally high amounts of melatonin include: 

  • Pistachios
  • Walnuts
  • Almonds

So, reach for a handful of nuts for an afternoon snack. Or consider adding pistachios to a tasty strawberry spinach salad.

Fruit

Another healthy option that can help you sleep well? Fruit. Some fruits with high melatonin include:3

  • Bananas
  • Oranges
  • Pineapple
  • Tart cherries

If you’d rather eat fruit with less sugar, avocados are a good choice. They’re packed with vitamins and potassium, and they also have magnesium. This mineral helps with muscle relaxation, energy production, and more. And some research shows a link between magnesium and decreased depression and anxiety,4 which can affect how well you sleep. Avocados also make a convenient snack, from avocado toast to a healthy take on chocolate pie.

Tea

Sipping a cup of tea can be a soothing way to end the day. And certain teas can help promote good sleep. Chamomile is an herb often used in tea and is known to help with sleep. Research shows chamomile can improve sleep quality. You can find many chamomile tea options in your local grocery store. Whichever tea you choose, select one without caffeine.

Of course, plenty of other foods have melatonin and magnesium. To find others, you can search the U.S. Department of Agriculture’s online database.

What not to eat before bed

It’s a good idea to avoid eating any food, especially heavy meals, too close to bedtime. If you’re hungry and you want a snack, keep it light — think fruit or handful of nuts. And in general, avoid caffeine at least 12 hours before you go to bed.

Considering a supplement to increase the melatonin or magnesium you’re getting? Talk to your doctor first. Many supplements can interfere with medications you may be taking.

More resources for better sleep

Need more help improving your sleep? From bedtime meditations to more tips for catching better z’s, we have you covered. Check out our online resource center on sleep.

1“About Sleep and Your Heart Health,” Centers for Disease Control, accessed December 17, 2024.

2Antia Verde et al., “ Melatonin Content in Walnuts and Other Commercial Nuts. Influence of Cultivar, Ripening and Processing (Roasting),” Journal of Food Composition and Analysis, January 2022.

3Harsha Pattnaik, “Nutritional Elements in Sleep,” Cureus, December 2022.

4“The Role of Magnesium in Depression, Migraine, Alzheimer’s Disease, and Cognitive Health: A Comprehensive Review,” Nutrients, July 2025.

5Asma Kazemi et al., “Effects of Chamomile (Matricaria Chamomilla L.) on Sleep: A Systematic Review and Meta-Analysis of Clinical Trials,” Complementary Therapies in Medicine, September 2024.

Last reviewed on January 14, 2026, by Susie Yeh, MD, and Dennis Hwang, MD 

Tags: