If you have a sweet tooth, it can be hard to resist just one last sugary treat in the evening.

But the key to stopping yourself snacking could be as simple as getting into bed.

A study found that an extra 20 minutes of sleep could help people cut back on the equivalent of half a slice of cake a day.

Sleep-deprived people who manage to spend more time in bed change to a heathier diet, according to researchers at King’s College London.

They found that when a group of people who slept less than seven hours a night were helped to get an average of just 21 minutes extra shut-eye, they cut their intake of unhealthy ‘free’, or added, sugars by almost 10g– a third of their daily allowance.

This is the equivalent of half a slice of cake with icing, or three chocolate digestives. The group also cut down on carbohydrates. It is believed sleep deprivation makes the brain cells react more strongly to unhealthy food, driving us to indulge in comfort eating.

This may be why people who do not get enough sleep often put on weight. Previous studies have shown sleep deprivation can cause people to eat an extra 385 calories a day. Dr Wendy Hall, of King’s department of nutritional sciences, said: ‘The fact that extending sleep led to a reduction in intake of free sugars, by which we mean the sugars that are added to foods by manufacturers or in cooking at home as well as sugars in honey, syrups and fruit juice, suggests that a simple change in lifestyle may really help people to consume healthier diets.’

The study looked 42 healthy people of normal weight who were slightly sleep-deprived, getting between five and less than seven hours of sleep a night. Half of these were given help to sleep longer, receiving four personalised tips such as avoiding caffeine, establishing a relaxing routine or not going to bed too full or hungry.

Results show 86 percent of the group managed to increase time in bed by an average of 55 minutes, while half increased their sleep duration by an average 21 minutes. After a month of better sleeping, people cut their sugar intake by an average of 9.6 grams a day – around a third of the recommended daily allowance, or about half a chocolate bar.

Commenting on the results, published in the American Journal of Clinical Nutrition, the team said it may also be that people ate less sugar because they were in bed longer and had less time to snack.

They added that their findings suggest ‘increasing time in bed for an hour or so longer may lead to healthier food choices’.