Staying active and fit could help to ward off some of the negative health impacts that would normally result from low-quality sleep, according to a large study of 380,055 middle-aged people involved in the UK Biobank research project. 

We all know that a healthy life means getting both plenty of exercise and enough good-quality sleep, but reality often gets in the way. The new research indicates that doing enough exercise could make up for some of the unhealthy impacts of bad sleep.

While the health benefits of exercise and sleep are nothing new, it's the relationship between them that is interesting in this particular study - it could even give doctors another option to suggest for patients dealing with sleep problems.

"We found those who had both the poorest sleep quality and who exercised the least were most at risk of death from heart disease, stroke, and cancer," says epidemiologist Bo-Huei Huang, from the University of Sydney in Australia.

"The findings suggest a likely synergistic effect, an interplay, between the two behaviors."

Using data gathered over the course of 11 years in the UK Biobank database, the team looked at normal weekly physical activity levels, measured in Metabolic Equivalent of Task (MET) minutes.

The weekly amount of exercise recommended by the World Health Organization (WHO) is 150 minutes of moderately intensive activity, or more than 75 minutes of vigorously intensive physical activity - this works out to be 600 MET minutes per week.

Participants were grouped into three levels of physical activity (high, medium or low) and were also given a sleep quality score from 0-5 based on the amount of shut-eye they got, how late they stayed up, insomnia, snoring and daytime sleepiness.

Those with the highest risk of dying from cancer or heart disease during the study period were those with the worst quality sleep and who didn't meet the WHO recommended guidelines for exercise. That risk went down for people with poor quality sleep but who did meet the exercise guidelines.

In the case of all forms of cancer, for example, those at the unhealthiest end of the sleep and exercise scale had a 45 percent higher risk of dying from cancer than those with good sleep scores who kept physically active. However, that risk just about disappeared for those who didn't score well on sleep but did score well on physical activity.

"Levels of physical activity at or above the lower threshold recommended by WHO appeared to eliminate most of the detrimental associations of poor sleep and mortality," write the researchers in their paper.

The study isn't enough to prove causation – that more activity causes the reduction in harms from poor sleep – and it's based on self-reporting rather than independent observations. That said, there's enough of a correlation here to interest scientists.

For now it's not clear why more exercise might make up for poor sleep, as far as our health goes. It could be that the increased activity is counteracting inflammation, or reducing irregularities in glucose metabolism, suggest the researchers.

That could be one of the avenues to explore in future research, but for now it's worth bearing in mind that while good-quality sleep and plenty of exercise is the ideal, one may help make up for the other – not to mention that getting in more activity can help with sleep issues, too.

"Both behaviors are critical for health but, sadly, our society suffers from both a physical inactivity and a poor sleep crisis," says population health researcher Emmanuel Stamatakis, from the University of Sydney.

"Considering that physical activity is perhaps more modifiable than sleep, our study offers people more health incentives to be physically active; and provides health professionals with more reasons to prescribe physical activity to patients with sleep problems."

The research has been published in the British Journal of Sports Medicine.