You walk into a room, only to forget why you came. It's a classic glitch in "working memory" that affects us all and that becomes more frequent during old age. By then, the prefrontal cortex, an area of the brain involved in higher functions including short-term memory, reasoning and forward planning, doesn't work as well as it once did.

But there might be an easy fix for the glitch. Writing in the journal Nature on Thursday, scientists say they have pinpointed a way to restore the aged prefrontal cortex to a more youthful state, simply by lowering levels of a chemical called cAMP (cyclic adenosine monophosphate).

Amy Arnsten, professor of neurobiology at Yale University, led a team of scientists who measured the activity of brain cells in the prefrontal cortex of young, middle-aged and old monkeys to study the effect of ageing on brain function. They treated the monkeys with guanfacine, a drug that reduces cAMP release in the brain. In older monkeys, lowering cAMP restored the activity of their brain cells to youthful levels. In younger monkeys, however, the effects were minimal.

This suggests that decreases in memory and other cognitive functions as the monkeys aged were being caused by increasing levels of cAMP, which acts as a signalling molecule inside cells. The chemical appeared to be reducing the activity of neurons in the prefrontal cortex.

"When you inhibit cAMP, you restore connectivity and the cells are able to excite each other again," said Arnsten.

Age-related problems with cognitive function are an increasing problem in an ageing population. According to the Alzheimer's Society, there are currently 750,000 people with dementia in the UK, for example, and that number is likely to rise to a million in the next 10 years.

At present, guanfacine is used to treat attention deficit hyperactivity disorder (ADHD) in children and hypertension in adults. The potential to use this drug on a wider basis, to help mitigate some of the effects of ageing on the brain, is being tested in a clinical trial by Yale University Medical School.

In her Nature paper, Arnsten said it was unlikely that guanfacine could be used to treat dementia, but that improving general brain activity may help to prevent it in the first place.

The findings have also illuminated some more general effects of cAMP on the brain. Arnsten said that rises in cAMP during times of stress increase the activity of more primitive parts of the brain, including the hippocampus and amygdala. This makes us act more instinctively and emotionally, while depressing activity in the prefrontal cortex, which controls rational thought.

"cAMP strengthens [evolutionarily] older parts of the brain and turns you from a rational person to this instinctive animal," she said. "And we think that when you're in danger, that can save your life. But if that stress is an exam, it's not very helpful."

Anna Perman is a freelance writer studying science communication at Imperial College London. She tweets as @thepermanator