Here’s another good reason to get more shut-eye and avoid sleep deprivation: skimping on sleep may give you the same kind of "munchies" pot smokers get—putting you at risk for weight gain. That’s because our brains naturally produce chemicals similar to those found in marijuana, called endocannabinoids.

“These chemicals have appetite-enhancing effects. They drive eating for pleasure, and seem to cause us to select yummier foods that are higher in fat, sugar, and salt,” says University of Chicago sleep expert Erin Hanlon, Ph.D., whose study on the subject was recently published in the journal Sleep.

“When we don’t sleep enough, there are higher concentrations of this chemical in our blood,” Hanlon says—and that could make the mid-afternoon allure of the cookie jar even harder to resist, which in turn can make you gain weight. “There is clearly a link between loss of sleep and an increase in the risk of obesity,” Hanlon says.

To test the hypothesis that lack of sleep results in elevated endocannabinoid levels, Hanlon and her team recruited 14 volunteers and allowed them to sleep either a healthy 8.5 hours per night or just 4.5 hours per night for four consecutive nights in the University of Chicago sleep lab. (All the volunteers underwent four-day stints of both sleep patterns.) Hourly monitoring of their blood revealed that the endocannabinoid levels of the 8.5-hours-per-night group peaked around lunchtime and then quickly fell again about 2 hours later. On the other hand, endocannabinoid levels in the sleep-deprived group peaked around 2 p.m. and remained elevated throughout the afternoon and evening.

Hanlon and her team then monitored the amount and type of food the volunteers ate. After both long sleep sessions and short sleep sessions, they consumed the same amount of calories at mealtimes. But between lunch and dinner the participants consumed around 600 calories in snacks after having a full night’s sleep, but a much higher 1,000 calories after the short sleep session.

In addition, the short sleepers were less able to resist eating tasty foods and consumed nearly twice as much fat and protein than they did after the longer sleep sessions. “The increased snacking occurred at the same time that we observed the increase in endocannabinoid levels," Hanlon says.

Lack of sleep didn’t just hinder the volunteers’ self-control. When questioned about how they felt, participants who were sleep-deprived reported stronger feelings of hunger than they did when they had slept 8.5 hours. The exact amount of sleep needed to avoid raising your endocannabinoid levels isn't clear, and is likely based on individual sleep needs, Hanlon says. But according to the National Sleep Foundation, adults should get between 7 to 9 hours of sleep per night.

Researchers and dietitians have long known there is a connection between lack of sleep and weight gain, but much of the research has focused on the chemicals leptin, ghrelin, and cortisol—other key chemicals known to affect our metabolism and hunger patterns. Hanlon’s research also monitored those chemicals, but it is the first to link lack of sleep and overeating to endocannabinoids. “Our study reinforces the importance of having good sleep hygiene,” Hanlon says. “Getting enough sleep is an essential aspect of maintaining overall good health.

But getting enough sleep isn’t always easy. According to a recent Consumer Reports survey, 68 percent of Americans—an estimated 164 million—struggle with sleep at least once a week, and 27 percent of Americans have trouble falling asleep or staying asleep most nights. If you are one of them, and feel the effects of sleep deprivation, consult our guide to falling asleep and staying asleep. It could help you avoid taking sleeping pills or using other sleep aids—and might help you shed a few pounds as well.