People who don't get enough sleep drink more soda and energy drinks than those who get the recommended amount of sleep per night, a new study finds.

In the study, researchers analyzed information from nearly 19,000 U.S. adults who participated in a national health survey from 2005 to 2012, which included questions about diet and sleep habits.

People who said they generally slept 5 hours or less per night drank an average of 21 percent more sugar-sweetened beverages, including soda and energy drinks, than those who generally slept 7 to 8 hours per night, the study found.

"We think there may be a positive feedback loop, where sugary drinks and [loss of sleep] reinforce one another, making it harder for people to eliminate their unhealthy sugar habit," study co-author Aric Prather, an assistant professor of psychiatry at the University of California, San Francisco, said in a statement.

In particular, those who slept less drank more caffeinated sugary drinks, the researchers found. The participants who usually slept 5 hours or less per night consumed 33 percent more caffeinated sodas and sugary energy drinks than those who got the recommended amount of sleep. People in the study consumed about the same amount of decaffeinated sodas, regardless of how much they slept, the researchers found.

The researchers noted that because the study was conducted at a single point in time, they can't tell whether sugary caffeinated drinks actually cause people to sleep less or whether people who don't get enough sleep are turning to sugar and caffeine to stay alert. But the researchers said it's possible that both are true, and that some people get caught in a vicious cycle in which their sleep habits affect their beverage choices and their beverage choices affect their sleep.

"This data suggests that improving people's sleep could potentially help them break out of the cycle and cut down on their sugar intake," Prather said.

The findings held even after the researchers took into account factors that could affect how much people slept or their consumption of sugar-sweetened beverages, including their age, household income, marital status, physical activity levels and whether they had been diagnosed with a sleep disorder.

There was no link between how long people slept and their consumption of juice, tea or diet drinks, the researchers said.

It's important to note that the participants in the study reported their own sleep habits, and it's possible that some people did not report their sleep accurately. Future studies could assess people's sleep habits objectively, with either a device that records brain waves or a wearable sleep monitor, Prather said.

Future studies also need to follow people over time to see how people's sleep habits and beverage consumption affect each other, Prather said.

The study is published online today (Nov. 9) in the journal Sleep Health.

Original article on Live Science.