If you’ve been burning the midnight oil, don’t be surprised if your skinny jeans start getting too tight. 

A study at the University of Colorado found that after one week of getting five hours of sleep a night, people gained an average of two pounds. Which means, cramming for finals, or working late on a deadline can pack on the pounds. 

In the first week of the study, half of the volunteers went to bed at midnight and woke up at 5 a.m., while the other half slept eight hours a night. During the second week, they flipped sleep schedules.

The result: Everyone gained weight during the restricted sleep phase. And those who caught up on sleep during the second week actually started to lose the weight they gained.

And the reason was clear: The people who were short on sleep adopted completely different eating habits. They ate less at breakfast – because their internal clock said they were still asleep. But then they OVERate at other meals. Overall, they ate 6-percent more calories, mostly carbs and fat. In fact, the sleep-deprived ate more calories after dinner than during any of their meals. 

But when they began getting more sleep, they ate fewer carbs and fats. And the weight started to come off.

The study’s authors say that sleeping more isn’t a silver bullet for weight loss. But it’s a good place to start.