Sleeping more than nine hours a night appears to suppress genetic factors that lead to weight gain, a study has found.
In contrast, getting too little sleep seems to have the opposite effect.
Previous research has shown an association between poor sleep and obesity, but the new findings reveal a complex interaction between sleep and genetic factors linked to body weight.
Scientists made the discovery after studying 1088 pairs of identical and non-identical twins.
Twin studies help researchers unravel genetic and environmental influences. Only identical twins share the same genes, and are therefore subject to the same genetic effects, so differences between them are likely to be due to environmental factors.
The study found heritability of body mass index (BMI) - a measurement relating weight and height - was twice as high for short than for long sleepers.
For twins sleeping less than seven hours a night, genetic factors accounted for 70 per cent of differences in BMI. In twins averaging more than nine hours' sleep, only 32 per cent of weight variations could be attributed to genes.
Nathaniel Watson, from the University of Washington, who led the US study, said: "The results suggest that shorter sleep provides a more permissive environment for the expression of obesity related genes.
"Or it may be that extended sleep is protective by suppressing expression of obesity genes."
The findings were published on Monday in the journal, Sleep.
Participants slept for 7.2 hours a night on average. They were mostly young, average age 36.6, well educated, Caucasian and female.
Their average BMI was 25.3 or just inside the "overweight" category. Clinical obesity is defined by a BMI of 30 or above.
A total of 38 per cent were female-female identical twins, which made up the most common pairing.
The scientists suggest hectic modern western lifestyles may contribute to obesity.
"Modern society with its ubiquitous technology often can cause misalignment between sleep need and sleep actualisation," they wrote. "This frequently has adverse consequences for cognitive (mental) function and metabolic, cardiovascular, and immunologic health.
"Indeed, over the past century habitual sleep duration has dropped 1.5 hours per night and since 2001 the percentage of US adults getting at least eight hours of sleep per night on weeknights has fallen from 38 per cent to 27 per cent."
They added: "Evidence is mounting that chronically reduced sleep times are associated with obesity."
Sleep may influence weight by affecting hormones, glucose metabolism and inflammation, they said.
Some studies have associated long sleep duration with heart disease, insulin resistance (a precursor to diabetes) and early death.
"We did not observe this in our sample, but our sample is much younger than those used in studies that established these adverse associations," the researchers wrote.
They said it was likely an individual benefited from more sleep "until sleep need and sleep actualisation are balanced".