Not when you have to get out of bed. Not when you have to step into a meeting. It’s when the clock strikes, signaling time for you to sleep.

As you crawl into bed, you wonder if things will be different. Will you shut your eyes and finally fall into slumber? Or will you once again stare at the ceiling, waiting until you drift asleep? If it’s the latter, you’re likely to end up exhausted the next morning, even though you went to bed early.

There are numerous reasons why we have difficulty falling asleep. Sometimes, it’s psychological. Other times, it’s due to the stresses that life cruelly throws at us. But what about our dietary habits?

We carefully plan out our diets to energize ourselves, trim our figures, and improve our overall health. Yet, the substances we ingest take a secondary role when it comes to sleep.

Here are four dietary factors that might be affecting your sleep:

Caffeine

Although coffee is the most obvious culprit, caffeine is present in other beverages and foods. A cup of brewed coffee contains about 100 mg of caffeine, a can of Red Bull has 80 mg of caffeine, a cup of brewed tea has 50 mg of caffeine, and a can of Coca-Cola has 34 mg of caffeine (source).

While these amounts might not sound like much, they add up, especially since portion sizes have increased over the years. Caffeine is also present in less obvious forms, such as certain protein bars (a Clif Energy Bar has 50 mg of caffeine), coffee-flavored snacks (think “java” or “mocha”-flavored ice cream and yogurts), and chocolate.

When caffeine is ingested, its effects are felt within 15 minutes. After 40 minutes, 99 percent of caffeine from coffee gets absorbed into the bloodstream. Although this stimulant absorbs quickly, it effects linger.

Like other substances, caffeine has a half-life, which is the time it takes for the amount of drug in the body to be reduced by half. For your average healthy human, caffeine’s half-life is 5.7 hours. So if you ingest 100 mg of caffeine at 2:15 pm, you would have 50 mg in your system at 8 pm, assuming no other caffeine is ingested afterward.

Even if you don’t physically feel the effects of caffeine, it can still affect your body and quality of sleep for hours afterward. For this reason, I switch to less-caffeinated or caffeine-free beverages later in the day, such as tea, juice, or lemon water.

Nicotine

Like caffeine, nicotine is a stimulant. It increases alertness, has addictive qualities, and interferes with sleep.

A study at the Johns Hopkins University School of Medicine compared sleep between 40 smokers with 40 nonsmokers. The results indicated that smokers spent more time in light sleep and less time in deep sleep compared to non-smokers. 22.5 percent of smokers also reported that they lacked restful sleep, while only 5 percent of non-smokers reported lack of restful sleep. The biggest differences were found early in the night, when nicotine levels were highest in the body.

When you add lower sleep quality to nicotine’s overall damaging effects to the body, there are compelling reasons to quit smoking. I don’t have personal experience with smoking or quitting smoking, but I’ve found a few effective methods to reducing caffeine dependence that can be applied to nicotine.

In order to drop a habit, you need to replace it with a different one. To begin, identify the triggers that cause you to smoke. The trigger might be a specific time of day, being near someone else who smokes, or entering a certain environment. You might be undergoing stress, boredom, or performing an activity when the urge strikes.

When you identify these triggers, you can start switching up your routine. For instance, if you feel bored, try walking around outside instead. Or, if you usually smoke while driving, bring along a pack of chewing gum. It’s not easy, but letting the urge come and pass will help you move closer to quitting nicotine in the long run.

Alcohol

Many people resort to a nightcap before heading to bed. It’s commonly believed that downing a glass of brandy, bourbon, or wine helps the body rest at night.

To an extent, this is true. Ethanol alcohol, which is found in alcoholic beverages, acts as a sedative. When the ethanol enters your system, you become drowsy soon afterward. But a deeper look shows that drinking alcohol before bed can actually backfire.

When you first go to sleep, your body makes adjustments to maintain a regular sleep pattern. However, once your body eliminates the alcohol, your sleeping patterns become disrupted in what is known as the “rebound effect”.

After alcohol enters the bloodstream, it leaves in two ways: 10 percent leaves through breath, perspiration, and urine, and 90 percent is broken down in the body (i.e. metabolized). The rate of metabolism is 0.015 of blood alcohol concentration (BAC) per hour, regardless of age, size, or ethnicity.

If you’re moderately drunk but not yet legally impaired, your BAC is likely between 0.06 and 0.08. Given the 0.015 rate of alcohol metabolism, your body takes around 4 to 5 hours to eliminate the alcohol. Once the alcohol gets eliminated, your body goes from deep sleep to REM sleep, which is easier to wake from. Not only does your sleeping time get cut short, but your body also has less time to fully repair itself.

The solution? If you’re going to drink, stop at least four hours before bedtime to give the alcohol time to wear off. Of course, this isn’t always a feasible option. Still, it’s a good idea to eat a meal filled with protein and carbohydrates beforehand to absorb some of the alcohol, or at least to snack while drinking. Drinking water will also help you stay hydrated and lessen the hangover effect.

The most important part is to know your limits. While we metabolize alcohol at the same rate, some need fewer drinks than others to get reach a certain BAC.

Late Dinners

We typically see a gradual increase in meal size as the day progresses: a gulp of coffee in the morning, take-out for lunch, followed by a full-sized dinner. Our meal patterns don’t come as a surprise when you consider how our days are structured. Time is of the essence as soon as we wake up, with only the evenings left to relax.

So how exactly does this impact our sleeping patterns?

While a large dinner may seem like a nice reward for a hard day’s work, it also means increased blood flow to the digestive system. Your body’s metabolism is stimulated as your stomach muscles work to process the meal. The physical feeling of food sorting itself out in your stomach can be especially uncomfortable at night.

Ideally, it’s best to consume your meal at least four hours before bedtime. You can also shift meals to earlier times in the day. When you eat a heavier lunch, there’s less of a need to devour food shortly before sleep.

The type of food you eat at night also makes a difference. In one study, participants were asked to eat either a carbohydrate-based high glycemic index (GI) meal or a low GI meal before bed. Participants who ate the high GI meal fell asleep faster than those who ate the low GI meal. When time was used as a variable, meals administered four hours before bed were more effective than one hour before bed.

Carbohydrates such as pasta, rice, and cereal help boost tryptophan in the body. This essential amino acid produces serotonin and melatonin, two important hormones for relaxation and sleep. Foods high in tryptophan include eggs, salmon, nuts, seeds, soy, lentils, bananas, and milk.

Notably, bananas also contain a lot of potassium and magnesium, which act as muscle relaxants. And as it turns out, there’s truth to the old advice about drinking a glass of milk before bed. Along with tryptophan, milk is high in calcium and minerals that calm the body.

Better Sleep is the Foundation for a Better Day

There are those who claim they sleep best after consuming a large meal, while others say they feel fine after drinking coffee late at night. Our bodies react differently to substances depending on our genetics and lifestyles. But if you’re constantly tossing and turning at night, one or more of the above may be a factor.

Sleep is important. When you sleep better, you feel better when you wake up. And when you wake up better, you put yourself on the right path towards being ready for the day.

Let’s Connect

Want to become more productive? Then check out my guide How to Get Anything You Want.

Improving the Quality of Your Sleep

“People look for retreats for themselves, in the country, by the coast, or in the hills . . . There is nowhere that a person can find a more peaceful and trouble-free retreat than in his own mind. . . . So constantly give yourself this retreat, and renew yourself.”