How Does Eating Affect Sleep?

Reviewed by: HU Medical Review Board | Last reviewed: February 2023

What you eat and drink, and when, can impact your sleep, sometimes dramatically. Some of the advice for eating and drinking for better sleep may seem like common sense. Other ways that food and beverages influence sleep may be less well-known.

Timing of meals and drinks

People who have night-time gastrointestinal reflux (GERD) are more likely to have insomnia, sleep apnea, and other problems sleeping. That may explain why eating half a cheesy, meaty pizza just before bedtime keeps you awake. Even if you do not normally have GERD, heavy foods eaten before bedtime can cause heartburn that keeps you awake.1,2

It may take some trial and error to find which foods disrupt your sleep. Many people report they get indigestion and/or poor sleep after consuming food or drinks that:3

  • Are high in acid, like citrus, tomatoes, and onions
  • Are fatty, fried, or spicy
  • Contain alcohol or caffeine

In general, eat your last heavy meal at least 2 hours before going to sleep.2

By providing your email address, you are agreeing to our Privacy Policy and Terms of Use.

Drinking and sleep

Some people have a drink at night to help them fall asleep. And it is true that alcohol makes you sleepy. However, it also leads to poor sleep later in the night. Alcohol interferes with REM sleep, which is necessary for you to feel rested in the morning. It also makes snoring and sleep apnea worse. Avoid drinking alcohol within 4 hours of bedtime.4-6

Alcohol is not the only drink that can get in the way of good sleep. Caffeine is another issue for many people. If you have a sleep disorder, your doctor may ask you to record how much coffee, tea, soda, or chocolate you consume and when. Caffeine late in the day can lead to insomnia or may make RLS worse. On the other hand, consuming large quantities of caffeine may be an attempt to mask daytime sleepiness caused by sleep apnea or narcolepsy.

Drinks that may help you get better sleep include chamomile tea, warm milk, and tart cherry juice.7

Magnesium-rich foods for sleep

Magnesium is a mineral found in many foods. It plays an important role in several body processes, such as metabolism, mood and stress regulation, heart and bone health, and sleep. Magnesium promotes sleep by helping the brain chemical GABA work. Doctors have discovered that too little magnesium in the diet can make insomnia and RLS worse.

Many people do not get enough magnesium in their diets, so eating more of certain foods may help with your sleep problems. Foods rich in magnesium include:8

  • Dark, leafy greens (spinach, kale)
  • Seeds and nuts (sunflower seeds, sesame seeds, cashews, almonds)
  • Squash, broccoli, and other vegetables
  • Beans and peas
  • Dairy products
  • Meat
  • Unprocessed whole grains
  • Chocolate
  • Coffee

Very large doses of magnesium can cause serious side effects. Talk with your doctor about the right amount of magnesium for you.8

Diet changes for restless legs syndrome

Sugar, dairy, caffeine, alcohol, and smoking are all known to make RLS symptoms worse. This is especially true if these are consumed in large quantities just before bedtime. Some people may need to completely cut 1 or all of these substances out of their life.9,10

Some people find it helps to add vitamin D, B9 (folate), iron, or B12 supplements to their diet, or to eat more food rich in these nutrients. Talk to your doctor before taking any supplements.9,10

Weight loss and obstructive sleep apnea

Doctors know that poor sleep can lead to weight gain, and weight gain can lead to poor sleep. That is why losing weight is recommended for many people with a sleep disorder, especially for obstructive sleep apnea.

About 40 percent of men who are overweight have sleep apnea. This increases to up to 90 percent of men with a body mass index (BMI) of 40 or higher. The good news is that even small to moderate weight loss can improve obstructive sleep apnea. One study found that losing 10 to 15 percent of body weight resulted in a 30 to 50 percent improvement in obstructive sleep apnea. That means that someone who weighs 200 pounds and loses 20 pounds can expect to sleep 30 to 50 percent better, all without a CPAP machine.11