A new study finds that staying up late -- because of studying, working late, traveling, or just being a night owl -- can lead to weight gain because people tend to crave junk food in the wee hours of the morning.

Researchers at the University of Pennsylvania in the US found that subjects who were kept up until 4 a.m. in a sleep lab ate more than 550 extra calories during the late-night hours. While prior research has associated sleep deprivation with increased snacking, this study adds to the mounting evidence that seven or eight hours of sleep does a body good, while also providing insights from a lab setting.

The randomized study, involving 225 healthy adults, found that people who spent only four hours in bed from 4 a.m. to 8 a.m. for five consecutive nights gained more weight than control subjects who slept 10 hours each night from 10 p.m. to 8 a.m. Plus the sleep-deprived subjects not only ate more calories, they also consumed more fatty foods during the late-night hours than at other times of the day.

The study also found that during sleep restriction, men gained more weight than women, and African Americans gained more weight than Caucasians.

The study, announced July 28, appears online in the journal Sleep.

A separate study published earlier this year also finds that sleeping a mere five hours a night during a workweek with unlimited access to snacks isn't good for your waistline. The study, led by the University of Colorado at Boulder, found that participants gained nearly two pounds (about 1 kilogram) in five days when put in such a situation.