Eating for better sleep: what to change, and when
Concrete numbers for caffeine, alcohol, dinner timing, carbs and magnesium so you fall asleep faster and wake up less, plus when to see a doctor.

Bad sleep costs you strength in the gym, slows recovery, and pushes your appetite toward fast calories the next day. Food is not a cure for insomnia, but a few specific moves — when you stop caffeine, how big dinner is, and a couple of micronutrients — are realistically worth 20 to 40 minutes of better sleep a night. Here is what to change, in order.
Caffeine: cut it off earlier than you think
Caffeine takes roughly 5 to 6 hours to drop to half its blood level, and up to 8 hours in slow metabolisers. A mug of filter coffee has 80 to 100 mg, a double espresso 120 to 150 mg, an energy drink 150 to 200 mg per can. Drink 200 mg at 4pm and you still have about 80 mg active at 11pm — half a coffee, right when you are trying to fall asleep.
- Last caffeine 8 to 10 hours before bed. If you sleep at 11pm, your cutoff is between 1pm and 3pm.
- Cap the total at 400 mg a day if you are a healthy adult.
- A pre-workout dose of 3 to 6 mg per kilogram of body weight (240 to 480 mg for an 80 kg lifter) makes no sense before an evening session. After 6pm, drop to 1 to 2 mg/kg or skip it.
- Count the hidden sources: black tea 40 to 60 mg, green tea 30 to 50 mg, cola 35 mg per 330 ml, dark chocolate about 20 mg per 30 g.
Alcohol: you fall asleep faster and sleep worse
Alcohol shortens the time it takes to drop off, but while your liver clears it (roughly one standard drink per hour) the second half of the night falls apart: less REM, more awakenings, higher heart rate through the night. Two drinks 90 minutes before bed already measurably lower sleep quality, and three or more wreck the night even if you spend a full 8 hours in bed.
If you drink, make the last one 3 to 4 hours before bed, add 500 ml of water per drink, and stay at two. Do not count on recovering well from a hard session that night.
Size and timing of the last meal
A big 700 to 900 kcal meal, especially a fatty or spicy one, needs 3 hours before bed. A smaller 200 to 400 kcal meal works 60 to 90 minutes out. Going to bed hungry is as bad as going to bed stuffed: if you are in a deficit and wake at 3am, you are usually short on evening calories, not on discipline. Fix it by moving 300 to 400 kcal from breakfast to dinner. If you get reflux, stay upright for 2 to 3 hours after eating and raise the head of the bed by 10 to 15 cm.
Evening carbs are not the enemy
A meal with 40 to 60 g of carbohydrate 1 to 3 hours before bed shortens time to sleep onset for most people, because it helps tryptophan reach the brain. That is roughly 200 g cooked rice, 300 g potatoes, 60 g oats, or two slices of bread with fruit.
If you train 4 to 6 times a week, put 50 to 60 percent of your daily carbs into the last two meals. You get better sleep and a better session tomorrow.
Protein: how much and when
If you train, aim for 1.6 to 2.2 g of protein per kilogram of body weight per day, split across 3 to 5 meals of 30 to 40 g. A final meal of 30 to 40 g of slower protein — 300 g Greek yoghurt, 200 g cottage cheese, or 150 g of meat or fish — feeds overnight recovery without the digestive load of a big fatty plate.
Micronutrients that actually move the needle
- Magnesium — you need 310 to 420 mg a day. 30 g of pumpkin seeds gives about 150 mg, 30 g of almonds about 80 mg, 200 g of cooked spinach about 80 mg, 30 g of dark chocolate 60 to 70 mg. If you rarely eat legumes and nuts, this is usually where you fall short.
- Iron — low ferritin (under 50 ng/ml) is a common driver of restless legs, especially in women. That is checked with a blood test, not by how you feel.
- Vitamin D — levels fall from October to April at our latitude, and low values track with worse sleep and daytime sleepiness.
Food first. If you suspect a deficiency, get tested and discuss doses with a doctor rather than following internet advice.
Fluids and night-time waking
You need roughly 30 to 35 ml of fluid per kilogram per day, plus 500 to 1000 ml per hour of training. The issue is timing: drink a litre in the last two hours and you will be up. Keep the final two hours to 200 to 300 ml and finish the rest by 8pm.
What one day looks like
- 2pm — last coffee.
- 6pm to 7:30pm — training, then 40 to 60 g carbs and 30 g protein.
- 8pm — dinner: 30 to 40 g protein, 40 to 60 g carbs, vegetables, moderate fat.
- 10pm — if hungry, 150 to 250 kcal such as yoghurt and fruit.
- 10pm to 11pm — 300 ml of fluid at most, no alcohol.
When to see a doctor
- Snoring with breathing pauses that someone else notices, or waking up gasping — possible sleep apnoea.
- Trouble sleeping 3 or more nights a week for longer than 3 months.
- An irresistible urge to move your legs in the evening — ask for ferritin and a full blood count.
- Heartburn 2 or more times a week, or chest pain at night.
- You sleep 7 to 8 hours and are still sleepy during the day, or nod off at the wheel.
The short version
- Last caffeine 8 to 10 hours before bed, 400 mg a day maximum.
- Two drinks at most, finished 3 to 4 hours before bed, or none if recovery is the priority.
- Big meal 3 hours before bed; a small 200 to 400 kcal one can be 60 to 90 minutes out.
- In the evening, 40 to 60 g carbs and 30 to 40 g protein, and do not go to bed hungry.
- Get 310 to 420 mg of magnesium a day from food, and check ferritin and vitamin D with a blood test.
General information, not medical advice. If you have a health condition or pain, talk to a doctor before changing how you train.


