Sometimes what's good for your heart is also good for your brain.

A recent study of US adults over 50 found that those who owned a pet for more than five years scored better on cognitive memory tests than those living without interspecies housemates.

The findings from the University of Michigan suggest the 'pet effect' can protect more than just the health of our guts and hearts; it could also play a role in our aging brains.

The results are based on a nationally representative survey from 2010 to 2016, which, amongst other questions, asked more than 20,000 adults over the age of 50 about their pet status.

Using these findings years later, researchers showed those who ticked the pet box showed interesting differences in their cognitive scores over the six-year testing period.

The effect was only evident in participants over the age of 65, which is usually when symptoms of dementia begin to show.

If a person in that age bracket had owned a pet for over five years, researchers found their short-term and long-term memory for words was much better than those who did not have a pet but were similarly aged.

Every time participants were tested over the six-year period, the pet cohort showed better scores, even as they inevitably grew older.

The findings are only an association, not clear evidence that the 'pet effect' actually exists. It could be, for instance, that people with better cognitive function are more likely to maintain longer pet companionships later in life.

That said, the study joins many recent studies that suggest having a pet is good for you. There are numerous theories as to why that is, all of which have yet to be proven.

Having a dog, for example, could mean pet owners are forced to get up and move about more, and daily movement is closely tied to brain health and functional longevity.

Animals also bring new bacteria into a household's circulation, which could improve our gut health for the better. Incidentally, the gut-brain connection is one that scientists have recently come to realize is far more important than we once thought.

Or perhaps pets simply make us happy. Studies suggest an animal's presence in our lives can relieve loneliness and alleviate chronic stress.

In old age, that could be more important than ever. Evidence has shown isolation can change the very structure and function of our brains.

There's even a chance all these theories are at least partly correct.

Common risk factors for dementia include physical inactivity, isolation, cardiovascular disease, depression/anxiety, and chronic stress.

In short, having a pet could help protect numerous different avenues to cognitive decline all at once.

But while most studies on pet ownership have focused on how dogs or cats impact our emotions and physical health, far fewer studies have looked at how pets impact our ability to think.

Some of those studies turned up null results. But the researchers at Michigan think that's because there's a lag in how long it takes a pet to impact our brains, and most previous studies have used short interactions with unknown dogs to test the effect.

And, as we all know, loneliness isn't conquered in a day. Nor is friendship built in a single petting session.

People shape their days around their pets, and these animal companions can impact just about every aspect of our lives.

Having someone to talk to throughout the day, even if they aren't a fellow human, could be exercising the verbal networks in our brains.

Pets could be keeping us young and fit on the inside as well as the outside.

The study was published in the Journal of Aging and Health.