A major new study of almost 500,000 adults has highlighted the health risks of not getting enough sleep or sleeping for too long.
Here are the key findings from the research by Cambridge University and Fudan University in China.
How long should I sleep for?
Experts found that seven hours of sleep per night was the optimal amount for people in middle and older age.
Sleeping for this length of time was found to be beneficial for both mental health and brain performance, including memory and problem-solving skills.
One possible reason for the link between lack of sleep and cognitive decline may be due to the disruption of 'deep' sleep, experts said.
A lack of sleep may also hamper the brain's ability to rid itself of toxins.
Watch: Influencer sparks debate after sharing her sleep arrangements
Is poor sleep linked to Alzheimer's and dementia?
The researchers say the findings suggest that sleeping for too long, or not enough, may be a risk factor for cognitive decline in ageing.
This is supported by previous studies that have reported a link between sleep length and the risk of developing Alzheimer's disease and dementia, in which cognitive decline is a hallmark symptom.
Professor Barbara Sahakian, from Cambridge University's Department of Psychiatry, said: "Getting a good night's sleep is important at all stages of life, but particularly as we age.
"Finding ways to improve sleep for older people could be crucial to helping them maintain good mental health and wellbeing, and avoiding cognitive decline, particularly for patients with psychiatric disorders and dementias."
Read more: This is the secret to a good night's sleep
Professor Jianfeng Feng, from Fudan University, said: "While we can't say conclusively that too little or too much sleep causes cognitive problems, our analysis looking at individuals over a longer period of time appears to support this idea.
"The reasons why older people have poorer sleep appear to be complex, influenced by a combination of our genetic make-up and the structure of our brains."
Who took part in the study?
The study involved almost 500,000 adults aged between 38 and 73.
Participants were asked about their sleeping patterns, mental health and wellbeing, and took part in a series of cognitive tests.
Brain imaging and genetic data were available for almost 40,000 of the study participants.
The research is published in the journal Nature Aging.