If you have trouble getting enough sleep at night, you might want to think about how much soda you’re drinking. Adults who sleep less than five hours a night are generally drinking more sugar-sweetened sodas than those who get a healthier amount of sleep, suggests a new study.

Researchers looked at data on nearly 19,000 adults and found that about 30% of them slept less than five hours a night. Interestingly, these same people also consumed more sugary drinks — which also happened to be caffeinated — than participants who slept seven to eight hours.

People who slept no more than five hours drank 26% more regular soda and 33% more caffeinated beverages than those who slept seven to eight hours.

The main source of sugar in the American diet is sodas, and both soda and insufficient sleep are associated with obesity. The consumption of sugary beverages is also associated with increasing rates of heart disease and diabetes.

“The most likely way in which soda consumption can negatively affect sleep is through ingesting the caffeine typically found in soda because caffeine blocks the binding of a particular chemical in the brain responsible for us feeling tired,” said lead author, Aric Prather, of the University of California, San Francisco.

It probably isn’t the sugar that interferes with the inability to sleep, but the lack of sleep causes one to consume more sugar, according to Prather, which can lead to obesity.

People who slept no more than five hours drank 26% more regular soda and 33% more caffeinated beverages than those who slept seven to eight hours. Those same people were also more likely to be smokers and sedentary. Chronic health problems and diagnosed sleep disorders were also more prevalent in this group.

People who don’t get enough sleep or who have poor quality sleep are more likely to gain weight and become obese. Those hours awake are often spent eating. That's how unhealthy sleep patterns can lead to an unhealthy diet. And so begins a downward spiral of sleep deprivation, poor diet, overweight and chronic disease.

While this study can't definitively prove that sodas are a direct cause of poor sleep, if you have a hard time getting a good night’s sleep, reducing the amount of soda you drink is probably a smart move. It may help you sleep better and also help you to eat less, eat better and manage your weight.

The study is published in Sleep Health.