Halloween is almost here and stores are filled to the max with candy. Although Halloween candy can be a nice indulgence, the sugar high (and sugar crash) from overeating these treats makes some regret opening that bag of candy before the trick-or-treaters even arrived.

We tend to discuss the negative effects that sugar can have on our body. If you’re anything like me, you’ll gravitate towards chocolate. What we don’t realize is that chocolate, besides being a sugary treat, also contains caffeine—something that can significantly disrupt your sleep.

Simply put, caffeine is a stimulant. Most people prefer to use it after waking up in the morning to increase alertness. It enters the bloodstream through the stomach and can work in as little as 15 minutes after consumed. Caffeine takes approximately 6 hours for just one half of the dosage to be eliminated from the body. For most, that glass of soda with dinner at 7 p.m. will only be half gone by 1 a.m. Plus, the older you get, the longer it takes for caffeine to leave your body, negatively impacting sleep even more.

MORE: Are You Too Tired to Enjoy Life?

Some people feel the effects of caffeine stronger than others, the reasons for which are still poorly understood. For many people, caffeine consumed later in the day can make it tough to fall asleep. However, we’re starting to learn that even those who don’t think caffeine affects their sleep at all actually do suffer from fragmented, poor quality sleep! I often see patients who swear to me that caffeine doesn’t bother their sleep, yet when I convince them to taper off it, they find they are much more restful.

Caffeine is the most commonly used mood-altering drug in the world. In addition to coffee, many sodas, teas, energy drinks, diet pills and headache medicines also contain caffeine. (Note: Just because it says “diet” or “herbal” doesn’t mean it is decaffeinated.)

Studies have shown that small doses (fewer than 30 milligrams) of caffeine per day can give you a pick-me-up and change your mood. Over 100 milligrams consumed daily can lead to caffeine dependence (withdrawal symptoms such as headache, irritability and stomach distress can occur if caffeine use is stopped). Most Americans consume approximately 250 milligrams of caffeine spaced throughout the day (averaging 2-3 cups of coffee, not including other sources of caffeine such as soda).

MORE: Tweak Your Diet to Fight Insomnia

Admittedly, different products have varying caffeine contents. One ounce of dark chocolate typically contains 20-30 milligrams of caffeine. Most people aren’t consuming just 1 ounce of chocolate at one sitting … especially with all the Halloween candy sitting around! Coffee contents vary based upon the person making it and the type of coffee, with some coffee shops having nearly two or three times the amount of caffeine in an 8-ounce cup as compared to a home-brewed, drip coffee. Even 1 cup of coffee ice cream contains 55-60 milligrams of caffeine!

Caffeine is considered safe to consume in moderation (200-300 milligrams; 2-4 cups of coffee per day), but it is not recommended for children and teenagers. Recent data suggests that caffeine can impair growth and brain development in children and teens, and it can suppress appetite and lead to malnourishment.

How do you know if you drink too much caffeine? If you drink more than four cups a day, or if you have insomnia, anxiety, irritability, stomach upset, muscle tremors, or rapid heartbeat after consuming caffeine. Consider cutting down if you find that you suffer from withdrawal symptoms after skipping that typical morning coffee.

Ways to cut down:

  1. Keep track of your caffeine consumption. Remember, even a few pieces of chocolate can add up! Look at medication labels to make sure they are caffeine-free.
  2. Switch to decaffeinated brands. Make sure to check that the label says “no caffeine” or “decaf.”
  3. Gradually cut back on caffeine intake. Some people find that drinking one glass less of soda or switching to a smaller cup of coffee every few days can help. Others mix caffeinated and decaffeinated together. For example, in a typical 8-ounce cup of coffee, start with 4 ounces of regular mixed with 4 ounces of decaf. After a week, switch to 2 ounces regular mixed with 6 ounces decaf and then wean down until the regular coffee isn’t needed anymore.
  4. Brew your tea for less time to decrease caffeine content.
  5. Finally, if you’re using caffeine to feel more awake, think again. Nothing is a substitute for a good night’s sleep. Make sleep a priority over caffeine, and you might just save some cash to boot.

MORE: Being Tired Actually Makes You Crave Sweets