We go to the gym for several reasons: To lose weight, to gain muscle, or to stay toned. Now, a recent study published in the journal Neurology suggests we (yes, I’m talking to you, couch potatoes) might be able to boost the health of our brains by going to the gym.

The Boston University School of Medicine researchers found being less physically fit not only shrinks our muscles, but it could potentially decrease brain health and volume in middle age.

“We found a direct correlation in our study between poor fitness and brain volume decades later, which indicates accelerated brain aging,” said study author Nicole Spartano, in a press release.

As we age, certain parts of the brain are prone to shrinkage, even in the absence of neurocognitive diseases like dementia or Alzheimer’s. The prefrontal cortex (in charge of abstract thinking and thought analysis), and the hippocampus (associated with memory and spatial navigation), experience the most notable volume decrease with age, according to the National Institute on Aging. This makes the brain increasingly vulnerable to cognitive dysfunctions, like memory loss and dementia.

To explore the effects of poor physical fitness, high blood pressure, and heart rate on brain volume, Spartano and her colleagues recruited more than 1,500 participants between the ages of 31 and 49 who did not have dementia or heart disease. The subjects took a physical fitness test using a treadmill and underwent MRI brain scans while the researchers monitored their heart rate and blood pressure. Two decades later, the group of participants retook the treadmill test and received another MRI.

The researchers analyzed the results of patients who had not developed heart disease or started taking beta blockers, medication that manages cardiac arrhythmias (irregular heartbeat), to control blood pressure or heart problems. This group had over 1,000 people.

Overall, those who performed worse on fitness tests were more likely to show smaller brain volume at the end of the study. On average, the authors found that the participants’ total brain volume shrank by roughly 0.2 percent a year. Participants who were 20 percent less fit produced less oxygen, clocked a heart rate of 17 beats per minute higher than average, and had a blood pressure 14 points above normal.

The participants had an average estimated exercise capacity of 39 mL/kg/min, which is also known as peak VO2, or the maximum amount of oxygen the body is capable of using in one minute. Physical capacity was estimated by using the length of time participants were able to exercise on the treadmill before their heart rates reached a certain level. For every eight units lower a person performed on the treadmill test, their brain volume showed shrinkage equivalent to two extra years of aging.

The study also showed that people whose blood pressure and heart rate went up during exercise were more likely to have smaller brain volumes two decades later. The researchers concluded people with poor physical fitness often have higher blood pressure and heart rate responses to low levels of exercise compared to those with better fitness. This is believed to be because physical fitness reduces blood pressure, decreasing strain on the brain.

However, Spartano cautioned that the study is observational and does not prove that poor physical fitness causes a loss of brain volume, it merely shows that there is an association between the two.

Although it’s not certain whether one factor causes the other, there’s a growing body of research that suggests a possible link between exercise and a healthier brain. A 2010 study found aerobic exercise appears to bulk up the size of the hippocampus. The research team found adults aged 55 to 80 years who walked around a track for 40 minutes three days a week for a year increased the volume of their hippocampus. The hippocampus grew 2.12 percent in the left hippocampus and 1.97 percent in the right hippocampus. According to the researchers, this effectively turns back the clock one to two years in terms of volume.

These neurology studies show the brain is still modifiable with exercise late in life. This could have implications for preventing age-related cognitive dysfunctions in a growing group of older adults, especially since they’re living longer.

Sources: Spartano NL, Himalo JJ, Beiser AS et al. Midlife exercise blood pressure, heart rate, and fitness relate to brain volume 2 decades later. Neurology . 2016.

Erickson KI, Voss MW, Prakash RS et al. Exercise training increases size of hippocampus and improves memory. Proceedings of the National Academy of Sciences . 2010.