Avoid caffeine (e.g. coffee, tea, soft drinks, chocolate) close to bedtime. It can keep you awake. Caffeine is a stimulant, which means it can produce an alerting effect. Caffeine products, such as coffee, tea, colas and chocolate, remain in the body on average from 3 to 5 hours, but they can affect some people up to 12 hours later. Even if you do not think caffeine affects you, it may be disrupting and changing the quality of your sleep. Avoiding caffeine within 6-8 hours of going to bed can help improve sleep quality. To determine how much caffeine you ingest daily, check out our Caffeine Calculator.