1. Magnesium: Related to Nervous-System and Muscle Relaxation, but Not a Sleeping Pill

Magnesium is one of the minerals people with sleep problems often pay attention to. It is involved in nerve signaling, muscle contraction, energy metabolism, blood-glucose regulation, blood-pressure regulation, and normal heart rhythm.

That is one reason magnesium is often discussed when stress, mental tension, and muscle tightness accompany poor sleep.

But magnesium should not be interpreted as “take it and insomnia goes away.” A 2021 systematic review and meta-analysis in older adults with insomnia suggested that magnesium supplementation may help with difficulty falling asleep, but study quality was limited and the evidence was not strong enough for firm clinical recommendations.

So magnesium is better understood as a sleep-support nutrient, not an insomnia medication.

Spinach, oats, black beans, almonds, pumpkin seeds, sesame, and whole grains rich in magnesium
Magnesium: dark green vegetables, nuts and seeds, legumes, and whole grains are better everyday sources.

Food Sources

Pumpkin seeds, chia seeds, almonds, cashews, peanuts, black sesame, spinach, lettuce, amaranth greens, black beans, edamame, soy milk, oats, brown rice, and whole-grain bread.

These are not foods that make you fall asleep immediately. Their value is helping provide magnesium, fiber, and plant nutrients that support a steadier nervous system and metabolic state.

Practical Approach

Most people can start by getting magnesium from food rather than immediately taking a high-dose supplement. For example: oats, soy milk, or whole-grain bread at breakfast; a serving of dark green vegetables at lunch or dinner; a small handful of plain nuts or seeds each day; and some brown rice, mixed beans, or whole grains as staples.

If your staples are almost always white rice and refined noodles, vegetables are limited, and nuts or legumes are rare, start with three changes: make staples a little more whole, vegetables a little darker, and add a small amount of nuts.

Safety

Magnesium from food is rarely a concern for excess intake. Long-term high doses from supplements or medications can cause diarrhea, nausea, and abdominal pain.

If you have impaired kidney function, take regular medications, are pregnant, or have a chronic condition, do not use magnesium supplements long term without professional advice.

2. Tryptophan: One of the Building Blocks for Serotonin and Melatonin

Tryptophan is an essential amino acid that the body cannot make and must obtain from food. It contributes to the production of serotonin, melatonin, kynurenine, and niacin. Serotonin is involved in mood regulation, while melatonin helps regulate circadian timing and sleep.

A 2022 systematic review and meta-analysis on tryptophan supplementation and sleep quality found that tryptophan, especially at doses of 1 g or more, may improve some aspects of sleep quality.

But that does not mean everyone who sleeps poorly needs a tryptophan supplement. For most people, the more practical approach is to get enough high-quality protein, whole grains, and regular meals so that sleep-related amino-acid needs are covered.

Eggs, milk, yogurt, salmon, tofu, pumpkin seeds, oats, and whole grains related to tryptophan intake
Tryptophan: high-quality protein, whole grains, and regular meals are a steadier strategy than chasing a supplement.

Food Sources

Eggs, milk, yogurt, fish, shrimp, chicken, turkey, tofu, soybeans, black beans, pumpkin seeds, sesame, peanuts, oats, and whole grains.

These foods do more than provide tryptophan. They can also supply high-quality protein, B vitamins, magnesium, and more stable carbohydrate sources that support daytime energy and sleep rhythms.

Practical Approach

Most adults do not need to calculate tryptophan separately. The practical goal is enough high-quality protein each day: include one source such as eggs, dairy, fish or shellfish, poultry, tofu, legumes, or nuts and seeds at each meal.

Dinner can include a moderate amount of protein such as eggs, fish, shellfish, tofu, or chicken, paired with a reasonable amount of steadier carbohydrate such as mixed-grain rice, oats, sweet potato, or pumpkin.

More protein at night does not automatically mean better sleep. A dinner that is too large or too late can increase digestive load and interfere with falling asleep or staying asleep.

Safety

Tryptophan from food is generally not a concern for excess intake. Do not combine tryptophan or 5-HTP supplements on your own, especially if you take antidepressants, anti-anxiety medication, or sleep medication, because drug interactions are possible.

People with chronic insomnia should first assess the type and cause of the sleep problem rather than repeatedly switching sleep supplements.

3. GABA: Worth Knowing About, but Not a First-Line Sleep Strategy

GABA, or gamma-aminobutyric acid, is an important inhibitory neurotransmitter involved in calming neural activity and reducing excitability. That is why many sleep products emphasize GABA.

But current evidence for oral GABA and sleep is far from definitive. A 2020 systematic review of 14 placebo-controlled human studies concluded that evidence for stress reduction was limited and evidence for sleep benefits was very limited.

So GABA may provide some support for certain people whose main issue is a “racing mind” or difficulty falling asleep, but it should not be described as a proven insomnia treatment.

Plain yogurt, natto, miso, tofu, fermented soy foods, whole grains, and vegetables
GABA: worth knowing about, but do not treat it as a first-line sleep solution; a stable overall diet matters more.

How to Think About It in Food

You do not need to eat large amounts of supplements or salty fermented foods just to get more GABA.

Rather than chasing a single “high-GABA food,” include fermented foods, whole grains, legumes, and vegetables as part of the overall diet. Their bigger value is improving diet quality, increasing fiber, and supporting the gut environment—not directly “sedating” you.

Reasonable options include plain yogurt, natto, miso, fermented soy foods, whole grains, legumes, and vegetables. Do not eat large amounts of pickles, preserved vegetables, or salty fermented foods just for sleep.

Practical Approach

For everyday diet changes, keep it simple: include fermented foods in moderation and make the overall diet more stable.

For people with insomnia, reducing evening stimulation, keeping a regular schedule, and decompressing before bed matter more. GABA-containing foods can be part of the diet, but they cannot replace sleep-habit changes.

Safety

If you use a GABA supplement, pay attention to dose, brand, and formula differences, and do not casually combine it with sleeping pills, anti-anxiety medication, anti-seizure medication, blood-pressure medication, or similar drugs.

People who are pregnant, breastfeeding, living with chronic disease, or taking medication should ask a clinician before using it.

4. Less Stimulation, Less Digestive Load: More Important Than “Sleep Foods”

For many people with insomnia, the first thing to change is not “what should I eat before bed,” but whether the diet contains too many things that keep the body stimulated or overloaded.

The main factors to watch are caffeine, alcohol, ultra-processed foods, and dinners or late-night meals that are very late, very large, very greasy, or very spicy.

Caffeine is especially important. A 2023 systematic review and meta-analysis found that caffeine reduced total sleep time by about 45 minutes on average, lowered sleep efficiency, delayed sleep onset, and increased wake time after sleep began.

Alcohol is not a good sleep aid either. It may make you feel sleepy faster, but it can disrupt the second half of the night, make sleep lighter and more fragmented, and may worsen snoring, sleep apnea, and nighttime awakenings.

A dinner with fish, vegetables, and whole grains while avoiding coffee, alcohol, sweets, and heavy late-night food
Less stimulation, less load: reduce coffee and strong tea later in the day, do not use alcohol to fall asleep, and keep dinner from being too late or too heavy.

Less coffee and strong tea later in the day, no alcohol as a sleep aid, fewer ultra-processed snacks and sugary foods, and a dinner that is not too late, too large, too greasy, or too spicy.

Try a 2-Week Experiment

Keep coffee in the morning when possible and avoid it after midday; avoid strong tea, milk tea, and energy drinks later in the day; and avoid large amounts of chocolate at night. If you are very sensitive to caffeine, move your last coffee to before 10 a.m.

People with insomnia should also avoid making sugary drinks, milk tea, cake, cookies, chips, instant noodles, fried chicken, sausages, processed meat, and packaged snacks a major part of everyday eating—especially in large amounts later in the day.

Dinner and Late-Night Eating

A dinner that is very late, very large, greasy, or spicy keeps the body busy digesting when it should be winding down. A better pattern is a moderate amount of staple food, high-quality protein, and plenty of vegetables—for example mixed-grain rice, sweet potato, fish, shellfish, eggs, tofu, chicken, dark green vegetables, and mushrooms. Ideally finish dinner 2–3 hours before bed.

If you are genuinely hungry before bed, a small amount of warm milk, plain yogurt, half a banana, or a small slice of whole-grain bread can be reasonable. Do not turn a snack into a second dinner, and avoid barbecue, fried food, desserts, or heavily seasoned late-night meals.

5. Sleep Environment: Dark, Quiet, and Cool Beats Bright, Noisy, and Hot

Sleep does not happen only in the brain; the environment matters too. Light, temperature, and noise all influence whether the body can transition into sleep.

A 2024 study in *JAMA Network Open* used insomnia-related Weibo data and satellite nighttime-light images across 336 cities in mainland China. Higher exposure to artificial light at night was associated with higher rates of insomnia-related reports. This was an observational association and does not show that nighttime light directly causes insomnia.

A 2024 systematic review on rising temperatures and sleep found that higher indoor or outdoor temperatures were generally associated with poorer sleep quality and shorter sleep duration, with larger effects during hot months, in vulnerable populations, and in hotter regions.

So for people prone to insomnia, the bedroom environment is not a minor detail. It affects whether the body can smoothly shift from alertness into sleep.

A quiet, dim, cool bedroom at night
Sleep environment: keep the bedroom as dark, quiet, cool, and comfortable as possible and reduce bright light and overheating at night.

The goal is for the bedroom to signal “this is where I sleep,” not “this is where I work, scroll, and worry.”

Key Adjustments

Aim for a bedroom that is a little darker, quieter, cooler, and more comfortable.

Start with three actions: dim the lights about an hour before bed; reduce visible light in the room during sleep; and keep the bedroom relatively cool and well ventilated.

If outside streetlights are bright, use blackout curtains. Cover or move device indicator lights. If you wake feeling hot, adjust blanket thickness or sleepwear. If noise is a problem, consider earplugs, white noise, or heavier curtains.

Safety

Scrolling on your phone, using very bright lights, working in bed, or watching highly stimulating content can all keep the brain in an alert state.

The more functions the bedroom serves, the harder it can be for the body to reconnect the bed with sleep.

6. Daily Rhythm: A Fixed Wake Time Matters More Than Forcing an Early Bedtime

When people cannot sleep, they often try to force an earlier bedtime. The harder they try, the less sleepy they feel; then they sleep in the next day, which makes the following night even harder.

A more important first step is a consistent wake time.

Stimulus-control therapy within CBT-I emphasizes going to bed only when sleepy; using the bed mainly for sleep; getting out of bed for a while if you cannot fall asleep; returning when sleepiness comes back; waking at the same time every day; and reducing long daytime naps.

Morning light, daytime activity, and a consistent wake time
Daily rhythm: start by fixing your wake time and getting more light and activity during the day instead of forcing yourself to go to bed early.

Key Steps

Keep your wake time as consistent as possible, including weekends, without sleeping much later than on workdays.

Get natural light soon after waking—for example by opening the curtains, taking a short walk outside, eating breakfast outdoors, or getting more daylight during your commute.

Avoid spending long periods lying in bed during the day. Naps can be fine, but keep them around 20–30 minutes and avoid napping too late in the afternoon.

Do not go to bed very early just to “wait for sleep.” If you are not sleepy, do a low-stimulation relaxing activity first. Going to bed when genuinely sleepy can help rebuild the association between bed and sleep.

Daytime Activity Matters Too

Regular daytime activity helps build sleep pressure and can reduce anxiety and tension. It does not have to be intense: brisk walking, cycling, strength training, yoga, and stretching all count. Consistency matters more than one occasional hard workout.

High-intensity exercise right before bed is not ideal for everyone. For most people, finishing exercise earlier in the day or by early evening makes winding down easier.

Safety

People with chronic insomnia should not try extreme sleep-restriction methods on their own or suddenly cut sleep time dramatically just to reset their schedule.

If insomnia has lasted a long time or is accompanied by significant anxiety, depression, or daytime impairment, seek support from a sleep specialist or evidence-based behavioral treatment.

7. Release Stress: Bedtime Is Not the Time to Solve Your Life

Many cases of insomnia are not caused by a body that is not tired, but by a brain that is too busy.

Unfinished work, relationship problems, worries about the future, and fear of “not sleeping again tonight” often become louder late at night. The more you try to force sleep, the more tense you become; the more tense you are, the harder it is to sleep.

CBT-I matters because it addresses not only the result—being unable to sleep—but also worry about sleep, unhelpful beliefs, hyperarousal, and habits that keep the cycle going.

So the goal before bed is not to keep working through every unresolved problem. It is to give the brain a clear signal that the day is ending.

A pre-sleep routine with writing a to-do list, dimming lights, breathing exercises, and putting the phone away
Release stress: give the brain a clear “workday is over” signal and move tomorrow’s tasks and worries out of the bed.

Recommended Steps

  • Stop handling work messages about an hour before bed.
  • Write down tomorrow’s tasks instead of rehearsing them repeatedly in bed.
  • Do 5–10 minutes of diaphragmatic breathing.
  • Try gentle stretching or progressive muscle relaxation.
  • Replace “I must fall asleep right now” with “I can let my body rest first.”

Practical Routine

A simple fixed routine might be: wash up → dim the lights → write tomorrow’s tasks → do a few minutes of breathing → put the phone away → get into bed.

The more consistent the sequence, the easier it is for the brain to associate those actions with sleep preparation. If thoughts keep looping, keep a small notebook nearby, write them down, and tell yourself you will deal with them at a set time tomorrow—not now in bed.

Safety

Sleep often gets worse when you try too hard. The more you force it, the more alert the body becomes. A gradual wind-down is more useful.

If you have developed strong fear around sleep—for example, worrying every evening that you “definitely will not sleep again”—diet and bedroom changes alone may not be enough. CBT-I or professional sleep treatment can be more helpful.

A Sample Day for People Prone to Insomnia

Breakfast

Choose oats, whole-grain bread, or mixed-grain porridge with eggs, plain yogurt or soy milk, a small handful of nuts, and a piece of fruit.

The goal at breakfast is steadier blood glucose and enough daytime energy—not relying on coffee on an empty stomach to push through. This also provides magnesium, B vitamins, fiber, high-quality protein, and some tryptophan.

Lunch

Choose mixed-grain rice, brown rice, or sweet potato with fish, chicken, lean meat, tofu, or legumes plus at least two vegetables.

A complete lunch can reduce the afternoon crash that drives people toward sweets, milk tea, and coffee. If you get hungry easily in the afternoon, increase the proportion of protein and vegetables rather than eating mostly refined starch.

Afternoon Snack

If you drink coffee, keep it in the morning or before midday when possible.

If you get hungry in the afternoon, choose fruit, plain yogurt, nuts, or whole-grain bread rather than milk tea, cake, or cookies. If you are sensitive to caffeine, avoid coffee, strong tea, milk tea, and energy drinks later in the day.

Dinner

Choose mixed-grain rice, pumpkin, or sweet potato with fish or shellfish, tofu, eggs, or chicken, plus dark green vegetables and mushrooms. Keep the meal relatively low in oil and excessive spice, stop before feeling overly full, and ideally finish 2–3 hours before bed.

If you are truly hungry before bed, a small amount of warm milk, plain yogurt, or half a banana can be reasonable, but avoid barbecue, fried food, desserts, and heavily seasoned late-night meals.

Bottom Line

Insomnia is not solved by one “magic sleep food.”

What matters more is helping the body stay alert during the day and wind down at night: reduce dietary stimulation and digestive load, get enough magnesium, tryptophan, high-quality protein, and fiber, reduce bright light and overheating at night, keep a stable schedule, and actively decompress before bed.

Foods worth prioritizing include dark green vegetables, whole grains, legumes, nuts and seeds, fish and shellfish, eggs, dairy, soy foods, fruit, and plain yogurt.

Things worth reducing first include afternoon coffee and strong tea, milk tea, energy drinks, alcohol, ultra-processed snacks, sugary desserts, very late or oversized dinners, and heavily seasoned late-night food.

When insomnia is a problem, get daylight and activity during the day, reduce coffee and strong tea later on, avoid very late or heavy dinners, keep the bedroom dark quiet and cool, keep the schedule steady, and do not carry stress into bed.

Health Note

This article is for health education and everyday dietary reference only. It is not a diagnosis or treatment plan and does not replace individualized advice from a physician or registered dietitian.

If insomnia occurs several times a week for more than 3 months, clearly interferes with daytime work or study, or is accompanied by loud snoring, waking up gasping, excessive daytime sleepiness, anxiety or depression, palpitations, or long-term medication use, seek medical or sleep-specialist evaluation.

Diet and lifestyle changes matter, but they cannot replace professional diagnosis and treatment.

References

  1. Chinese Medical Association Neurology Branch, Sleep Disorders Group. Chinese Guidelines for the Diagnosis and Treatment of Adult Insomnia (2017 edition). https://cmab.yiigle.com/uploads/guide_html/%E4%B8%AD%E5%9B%BD%E6%88%90%E4%BA%BA%E5%A4%B1%E7%9C%A0%E8%AF%8A%E6%96%AD%E4%B8%8E%E6%B2%BB%E7%96%97%E6%8C%87%E5%8D%97%282017%E7%89%88%29.html
  2. Edinger JD, et al. Behavioral and psychological treatments for chronic insomnia disorder in adults: an American Academy of Sleep Medicine clinical practice guideline. 2021. https://doi.org/10.5664/jcsm.8986
  3. NIH Office of Dietary Supplements. Magnesium - Health Professional Fact Sheet. https://ods.od.nih.gov/factsheets/Magnesium-HealthProfessional/
  4. Mah J, Pitre T. Oral magnesium supplementation for insomnia in older adults: a Systematic Review & Meta-Analysis. 2021. https://pubmed.ncbi.nlm.nih.gov/33865376/
  5. Sutanto CN, et al. The impact of tryptophan supplementation on sleep quality: a systematic review, meta-analysis, and meta-regression. 2022. https://pubmed.ncbi.nlm.nih.gov/33942088/
  6. Hepsomali P, et al. Effects of Oral Gamma-Aminobutyric Acid (GABA) Administration on Stress and Sleep in Humans: A Systematic Review. 2020. https://pubmed.ncbi.nlm.nih.gov/33041752/
  7. Gardiner C, et al. The effect of caffeine on subsequent sleep: A systematic review and meta-analysis. 2023. https://pubmed.ncbi.nlm.nih.gov/36870101/
  8. Gardiner CL, et al. Dose and timing effects of caffeine on subsequent sleep: a randomized clinical crossover trial. 2025. https://pubmed.ncbi.nlm.nih.gov/39377163/
  9. Pourmotabbed A, et al. Ultra-Processed Food Intake and Risk of Insomnia: A Systematic Review and Meta-Analysis. 2024. https://pubmed.ncbi.nlm.nih.gov/39519600/
  10. Duan J, et al. Outdoor Artificial Light at Night and Insomnia-Related Social Media Posts. JAMA Netw Open. 2024. https://pubmed.ncbi.nlm.nih.gov/39565624/
  11. Chevance G, et al. A systematic review of ambient heat and sleep in a warming climate. 2024. https://doi.org/10.1016/j.smrv.2024.101915
  12. CDC. About Sleep. https://www.cdc.gov/sleep/about/index.html
  13. Mayo Clinic. Insomnia treatment: Cognitive behavioral therapy instead of sleeping pills. 2023. https://www.mayoclinic.org/diseases-conditions/insomnia/in-depth/insomnia-treatment/art-20046677

If insomnia recurs for more than 3 months or is accompanied by clear daytime impairment, loud snoring, waking up gasping, anxiety or depression, palpitations, or long-term medication use, seek evaluation from a sleep specialist or physician.

Back to all articles Back to featured articles