Lack of sleep not only makes you cranky and accident prone – it may also put your "fat genes" into high gear, a new study suggests.

"The less sleep you get, the more your genes contribute to how much you weigh. The more sleep you get, the less your genes determine how much you weigh," lead author and neurologist Nathaniel Watson told USA Today.

Dr. Watson and colleagues at the University of Washington Medicine Sleep Center in Seattle looked at the height, weight and sleep habits of 604 pairs of identical twins and 484 sets of fraternal twins. After analyzing the data, they reached the following conclusions:

Story continues below advertisement

Dr. Watson noted that both BMI and the need for sleep are inherited traits. Even so, "we see differences in how much twins weigh based on their sleep duration," he said.

That doesn't mean people can sleep themselves thin, Dr. Watson told the Huffington Post. "But you can sleep yourself to a point where environmental factors, like diet and activity, are more important in determining your body weight than genetics."

The research may seem at odds with a 2008 study showing a link between excess sleep – more than nine hours a night – and obesity. But researchers of that study, conducted by the U.S. National Center for Health Statistics, found that nearly half of people who slept nine hours or more each night were physically inactive in their leisure time, and many had serious health problems.

Dr. Watson and his co-authors acknowledged that more than 20 genes are involved in regulating energy use, fat storage, appetite and the body's ability to process glucose.

Story continues below advertisement

Still, "there is an amount of sleep where people become less healthy," Dr. Watson told ABC News. "Most people need between 7 and 9 hours a night."

How many hours of sleep do you get a night? Do you put on weight when you're sleep deprived?