It’s said that you are what you eat.

But apparently you also eat how you sleep.

In a new study, researchers say they may have uncovered why people eat more when they are sleep deprived.

The scientists concluded a lack of sleep triggers an increase in blood levels of a chemical that causes people to overeat and gorge more on sweet and salty high-fat snack foods.

“It’s important to understand that adequate sleep is important in maintaining good health,” Erin Hanlon, PhD, a study author and a research associate in endocrinology, diabetes and metabolism at the University of Chicago, told Healthline.

The findings were published today in the journal Sleep.

Read More: Ten Things That Happen to Your Body When You Don’t Sleep »

Little Sleep, Lots of Snacks

The researcher studied the sleeping and eating patterns of 14 healthy men and women in their 20s. 

The volunteers spent two, four-day sessions at the University of Chicago’s Clinical Research Center.

During one stay, they spent 8.5 hours a day in bed, averaging 7.5 hours of sleep.

During the other stay, they spend 4.5 hours a day in bed, averaging 4.2 hours of sleep.

During both four-day stays, the participants were served identical meals at 9 a.m., 2 p.m. and 7 p.m.

Researchers said the volunteers when deprived sleep reported significant higher levels of hunger. This was particularly true after the 2 p.m. meal.

During that period, they took in more than 300 extra calories by munching on snacks. That was despite the fact they were burning only about 70 calories by staying awake for four extra hours.

“They weren’t eating because they needed more energy,” Hanlon said.

On the fourth day of the sleep-deprived stay, participants were offered an array of snack foods. Despite having consumed a meal that supplied 90 percent of the daily caloric needs only two hours before, the participants still had trouble limiting their snack consumption.

In addition, they chose foods that had 50 percent more calories, including twice the amount of fat, as they did during the normal sleep stay.

Read More: Is Overeating All in Your Head? »

Chemical Reaction

Researchers measured levels of the hormone ghrelin, which boosts appetite, and leptin, which signals fullness, in their blood, as previous studies have done.

However, the researchers also measured the blood levels of endocannabinoids. That’s the same system targeted by the active ingredient of marijuana to enhance the desire for food.

Researchers said they noticed these levels increased about 33 percent during the days the participants were sleep deprived.

The levels peaked about 2 p.m. and stayed elevated until 9 p.m.

Hanlon said the study, despite its small sampling and short duration, still shows the importance of sleep to eating habits.

She added it’s not only how much sleep an individual gets but also the pattern of sleeping about the same length and time each day.

“Routines seem to be important,” she said. “Part of that routine is to have good sleep hygiene.”

Hanlon said the study findings are particularly important in today’s society where it’s estimated that get less than seven hours of sleep a day.

She said adequate sleep is just as important as exercise and a good diet for overall health.

“If you're sleep deprived,” she said in a statement, “your hedonic drive for certain foods gets stronger, and your ability to resist them may be impaired. So you are more likely to eat. Do that again and again, and you pack on the pounds."

Read More: Can Technology Really Help You Sleep Better? »