Sleeping for eight hours a night is the secret to not putting weight on, according to scientists.
They found that those who slept for less than six hours a night - or more than nine - put on more weight than those who slept for seven or eight hours each night.
The research published in the Journal Sleep found those who did not get enough sleep gained almost 4.4lbs (2kg) compared to those who slept for the recommended number of hours.
Those who had too much sleep gained 1.58 kilos (1.58kg) more than those who slept for the recommended number of hours over six years.
Short sleepers were 27 per cent more likely to become obese and long sleepers were 21 per cent more likely than those had an average night’s sleep.
The research also found that things were worse for people who got less sleep as they were 35 per cent more likely to gain 11lbs (5kg) over six years than those who had seven or eight hours sleep.
Those who slept too long were 25 per cent more likely to gain 11lbs (5kg) in the same time.
The reason that the amount of sleep a person gets can govern their weight is because sleep affects hormones levels, especially those involved in appetite and feeling full after a meal.
The study was carried out by Jean-Philippe Chaput, of Laval University in Quebec, Canada.
He said: “Our study provides evidence that both short and long sleeping times predict an increased risk of future body weight and fat gain in adults.
"Furthermore, these results emphasize the need to add sleep duration to the list of environmental factors that are prevalent in our society and that contribute to weight gain and obesity.
"Since preventing obesity is important, a pragmatic approach adding sleep hygiene advice to encouragement towards a healthy diet and physical activity may help manage the obesity epidemic.”
The study is based on 276 adults aged between 21 and 64 and the researchers took into account their weight at the beginning of the study.
UK and American sleep experts say the chances of getting a good night’s rest increase if you go to bed and get up at the same time every day, even at weekends and set a relaxing routine before getting into bed such as having a bath or reading.
Watching television in bed is not recommended and it is best to avoid stimulants such as alcohol, caffeine, chocolate and exercise in the evening.
If you have trouble getting to sleep it is best to get up and do something relaxing like reading until you feel ready for sleep.
Almost everyone has problems sleeping at some point in their lives, normally because of stress, and around a third of people in the UK have bouts of insomnia.