Near the end of life, many elderly people’s physical health and cognitive function take a rapid turn for the worse. Although it’s not fully understood why this happens more quickly in some people than in others, new research published in the journal Psychology and Aging suggests surrounding yourself with friends long after your hair turns grey is the key to successful aging, better quality of life, and a later onset of health deterioration.

An international team of researchers found that leading an active social life and participating in joyful activities were more beneficial for physical and cognitive functioning, and for promoting self-esteem, than relationships with family members, The Pacific Standard reported. The recent study builds on previous research that has linked social relationships and friendships to better health and wellbeing. Conversely, social isolation and feelings of loneliness can manifest in a physical way, becoming as detrimental to health as physical inactivity and an unhealthy diet.

“Social engagement is considered a key driver of life satisfaction in older adults,” study authors wrote. “Social activities promote feelings of competence, physical health, and cognitive functioning, which in turn contribute to high well-being.”

For the study, researchers combed through data of more than 2,900 now-deceased participants in the German Socio-Economic Panel Study, an annual survey of residents from former East and West Berlin about their employment status, occupation, and overall health and satisfaction. Participants rated life satisfaction on a scale of one to 10. How often they socialized was measured on a scale of one to four, with one signifying at least once a week and four signifying never. To assess health declines, researchers used information about mortality status and year of death for deceased participants that was obtained at the yearly interviews, either directly from the surviving household members or neighbors or from official registries.

The study found that frequently participating in social activities and events into the golden years was associated with maintaining well-being. In fact, those who prioritized socializing had better health and felt more satisfied in their final years than their counterparts. This is because an active social life “often involves cognitive stimulation and physical activity, which in turn protect against neurophysiological and cardiovascular pathology underlying cognitive decline,” study authors wrote. Maintaining cognitive function may make it easier to maintain well-being.

While having a good relationship with family members is expected to be essential for people’s well-being at the end of life, the study found that strong family relationships had little effect on well-being and “did little to stall end-of-life declines,” The Pacific Standard reported.

Being a social butterfly into late life seems to help mitigate and delay terminal decline in well-being, the researchers said.

Study authors concluded: “Older adults, even at the end of life, continue to play an active role in shaping their own well-being by engaging in social activities and by prioritizing social goals.”

However, researchers say more study is needed to understand the underlying mechanisms of end-of-life decline.

Source: Gerstorf D, Hoppmann C, Lockenhoff C, et al. Terminal Decline in Well-Being: The Role of Social Orientation. Psychology and Aging. 2016.