When financial planners talk about "longevity risk," it isn’t that they don't wish you a long life. They're simply concerned that you may live a long life without the ability to pay for that long life. But there’s a related risk that doesn’t get enough attention. It's the risk of living a long life in poor health.

A recent book, Life Reimagined, provides a comprehensive survey of the latest research on how to best navigate the path from midlife onward. Author Barbara Bradley Hagerty found much to be hopeful about, and much that we can do to live a long, healthy, fulfilling life.

Three key factors

Throughout the book, three factors came up again and again, each one having a positive impact on how long we live and how well we live: Relationships, engagement, and purpose.

Relationships. Of the three, having strong relationships is especially important. According to Hagerty, “All the research converges on one unshakable imperative: If you want to live a long and healthy life, invest in friends, particularly at midlife.”

In one study she cited, Harvard researchers found that people without close friends were three times as likely to die over the nine-year study period as those who had strong friendships. “In fact,” Hagerty wrote, “people with healthy lifestyles and no friends died earlier on average then those who smoked, drank, and shunned exercise, as long as the latter had friends.”

Hagerty also noted the research of John Cacioppo, a professor of psychology at the University of Chicago who found that social isolation can make cancer replicate faster, make tumors metastasize more quickly, and generally wreak havoc on your life. “It robs you of sleep, it afflicts you with micro-awakenings, and when you finally rise in the morning, exhausted, your cortisol level is higher, suggesting you are bracing for another stressful, threatening day. You never relax. And if you are over sixty, loneliness makes you far, far more likely to die.”

Regularly spending time with others also seems to ward off dementia. “Harvard researchers tested and retested the memories of people in their fifties and sixties over six years. Socially active people had less than half the memory loss of those who were less engaged.”

How many social connections you have isn’t nearly as important as the quality of those connections, and you get extra points if those relationships are outward focused. As one researcher explained, “when those connections involved helping other people, reaching out, being actively engaged to do things for others, that was an added bonus on top of what we already see as quite beneficial from the social contacts themselves.”

As for most people’s most important relationship, their marriage, the research is mixed. It indicates that men and women in happy marriages live longer than single people. However, those “who were unhappily married or divorced generally died younger than those who never married at all.”

Engagement. What predicts fulfillment at the end of life? Hagerty said the research points to being actively involved in life.

As Harvard researcher Robert Waldinger put it, “When we think about older people who are vital, it’s often because they’re still thinking about the world and the future. They’re keeping up with current events. They’re excited to tell you about the book they’ve read. They’re thrilled about the way the garden is coming in this year. They’re engaged.”

Yaakov Stern, a neuroscientist at Columbia University, agrees. He and his colleagues found that older people who are actively engaged in life had a 38 percent lower risk of developing dementia than the least engaged.

As engaging as it may be to read a good book or nurture a beautiful garden, outward-focused engagement, such as volunteering, is best.

The studies Hagerty reviewed found that spending time contributing to a cause that matters to you provides a wide range of benefits — everything from more happiness to less depression, and from less chronic pain to a longer life. However, it may be best to forget all that and just volunteer because you believe in the cause. Researchers have found that if you help out primarily to feel better about yourself, “you are just as likely to die early as the person who didn’t lift a finger.”

Purpose. Volunteering is closely related to this last point: “Dozens of new studies show that if you have a reason to get up in the morning, you will live longer [and] you will enjoy a happier old age.

That much is intuitive. However, having a clear life purpose has also proven to promote brain health. While cognitive function does tend to decline with age, Hagerty said two attributes predict “with astonishing precision” whether you will develop dementia. First, people who are especially “conscientious”—that is, who are dependable, goal-oriented, and able to control their impulses—had a nearly 90 percent lower risk of developing Alzheimer’s than the least conscientious people.

And second, people who have a clear life purpose—who find each day meaningful—are two and a half times less likely to develop dementia than those without a clear life purpose.

To be sure, genetics play a role in how long we will live and whether we will get dementia, cancer, or other illnesses. However, the research Hagerty reviews in “Life Reimagined” shows there are many factors that are well within our control when it comes to how long and how well we will live.