The key to staying sharp when you’re older is as simple as slipping between the sheets, according to a new study.

Researchers found that older people who had sex more often than others had increased brain power — scoring better on verbal, visual and spatial perception tests.

The study was published Wednesday by The Journals of Gerontology, Series B: Psychological and Social Sciences and carried out by researchers from Oxford and Coventry Universities in the UK.

Seventy-three participants — 28 men and 45 women — between the ages of 50 and 83 were asked about their sexual habits.

Thirty-seven said they had sex weekly, 26 monthly and 10 never.

Those who had sex on a weekly basis performed better on tests than those who only had sex monthly or not at all.

They did better on tasks that included naming as many words or animals beginning with the letter F as possible in one minute and copying complicated designs or drawing a clock face from memory.

But there was no difference among participants in memory, language and attentiveness tests.

“Every time we do another piece of research we are getting a little bit closer to understanding why this association exists at all, what the underlying mechanisms are, and whether there is a ‘cause and effect’ relationship between sexual activity and cognitive function in older people,” said lead researcher Hayley Wright from Coventry University.

This article originally appeared in the New York Post