A cola night cap may not be the best idea before going to bed, research suggests.
People who sleep no more than five hours a night consume significantly more sugary caffeinated drinks than those getting a good seven or eight hours of shut-eye, a study has shown.
But whether sugar-sweetened drinks make it harder to sleep or poor sleep causes people to seek out sugar and caffeine is still not clear, say scientists.
Both could be having an effect, they believe.
US lead researcher Dr Aric Prather, from the University of California at San Francisco, said: "We think there may be a positive feedback loop where sugary drinks and sleep loss reinforce one another, making it harder for people to eliminate their unhealthy sugar habit.
"This data suggests that improving people's sleep could potentially help them break out of the cycle and cut down on their sugar intake, which we know to be linked to metabolic disease."
Dr Prather's team analysed data from 18,779 participants in the National Health and Nutrition Survey, an ongoing US study of dietary habits and health.
Investigators recorded how much sleep people were getting as well as their consumption of various beverages including caffeinated and non-caffeinated sugar-sweetened drinks, fruit juice, artificially sweetened drinks, and plain coffee, tea and water.
The study found that participants who regularly slept five or fewer hours per night also drank 21% more caffeinated sugar-sweetened beverages than those who slept seven to eight hours per night. The beverages included both sodas and non-carbonated energy drinks.
People who slept six hours per night consumed 11% more caffeinated sugary drinks, demonstrating a "dose effect" with more drinks associated with less sleep.
No links were found between sleep duration and consumption of juice, tea or diet drinks.
The scientists took account of a range of socio-demographic and health factors that might have influenced sugary drink consumption and sleep.
Previous research has strongly indicated that sleep deprivation increases appetite, especially for sugary and fatty foods, said Dr Prather.
He added: "Short sleepers may seek out caffeinated sugar-sweetened beverages to increase alertness and stave off daytime sleepiness. However, it's not clear whether drinking such beverages affects sleep patterns, or if people who don't sleep much are more driven to consume them. Unfortunately, the data in the current study do not allow us to draw any conclusions about cause and effect."
The findings are published in the latest issue of the journal Sleep Health.