Those who sleep too much or too little may be putting themselves at risk of dementia, reveal scientists.
American researchers had found that older women who had managed seven hours a night had far better concentration and memories than those who slept for nine hours.
Those who got less than five hours had been also found to suffer.
The academics believed that those who suffered cognitive decline - leaving them less sharp in old age - may be more prone to dementia.
There is already evidence that having more than seven hours of sleep a night can lead to weight gain and up the risk of heart problems and diabetes.
However, the new study is one of the first to link it to the concentration problems.
The research had looked at 15,000 women in their 70s over five years.
The participants had all underwent regular tests to check their memory, concentration and attention span and those who usually slept for seven hours performed far better than those who got less than five hours, or more than nine.
"Our findings support the notion that extreme sleep durations and changes in sleep duration over time may contribute to cognitive decline and early Alzheimer's changes in older adults," the Daily Mail quoted lead researcher Elizabeth Devore of Brigham and Women's Hospital, Boston, as saying.
"The public health implications of these findings could be substantial, as they might lead to the eventual identification of sleep-based strategies for reducing risk of cognitive impairment and Alzheimer's," she said.
According to the spokesman for the Alzheimer's Society, "a good night's sleep is one of the pleasures of the life but, once again, this robust research suggested that the quality and duration of sleep had been also linked to people's cognitive health."
"While this link is now quite well-established, more research is needed to determine whether factors like sleep duration are a cause or effect of cognitive decline," he said.
"We're not saying you shouldn't enjoy the occasional lie-in, but good-quality sleep, eating a balanced diet, maintaining a healthy weight and exercising regularly can all make a difference in reducing your risk," the spokesperson added.