Sleep is an essential part of life. Without it, your body—and mind—don’t work up to par. That may be especially true as you age. A recent study suggests that older adults who sleep better think better overall.

An aging brain?

You probably know firsthand how a lack of sleep can muddle your mind. An international study looked at this link as it relates to aging. Researchers asked more than 30,000 older adults about their sleep patterns. Study participants reported on how well they slept and how long they slept over two days.

To see how poor sleep might affect brain function, researchers then asked the adults to do a series of cognitive tests. The tests assessed each person’s memory and thought processes. For example, one test had participants recite an ever-growing list of numbers.

The result? Adults who slept less than six hours a night scored lower on the tests. So, too, did those who slumbered an average of nine-plus hours every night. But adults who rated their sleep quality as good scored much higher. The researchers note that better sleep may help avert some of the age-related changes that happen to the brain.

Better brain function

Contrary to common belief, older adults need just as much sleep as younger people. That’s about seven to nine hours a night. But sleep patterns can change as you age. In particular, older adults tend to spend less time in deep sleep. As a result, they may wake up easier and more often. That may affect their mental abilities.

A recent study in Nature explored this connection. A group of younger and older women were asked to memorize a list of words. They then recalled the words 10 minutes after learning them and eight hours after sleeping. During the memory test, researchers looked at the women’s brain activity with an imaging machine. Overall, older women did worse on the memory test, especially after sleeping. Researchers saw less brain activity in the areas that help with long-term memory.

You may not be able to fend off all age-related brain changes. But sleeping better may help. Here are some ways to ensure a better night’s rest and save your aging brain in return:

  • Set a sleep schedule. Try to go to bed and wake up at the same time every day.
  • Prep your bedroom for sleep. Make sure it’s dark and quiet. Keep the temperature comfortable.
  • Watch your diet. Stay away from caffeine and alcohol too close to bedtime.
  • Build a sleep routine. Do something that relaxes you at the end of your day. For instance, read a book or listen to music.
  • Talk with your doctor about any sleep problems. Some health conditions or medicines for them can disrupt sleep.

Sleep plus a lifetime of learning

Want to help stave off dementia? Add a lifetime of learning to a better night’s rest. A recent study in the journal JAMA Neurology found that people who worked their brain throughout their life were less likely to develop dementia. Even more intriguing, those who took up intellectual pursuits in mid and late life had an even lower risk for the brain disease. No matter your age, activities such as reading, playing games, working on the computer, and simply being social may keep your brain sharp.