LuckyBusiness | Getty Images

Here's how you can shore up your finances and lengthen your life expectancy at the same time: Follow your doctor's orders. A recent report from HealthyCapital, a company that provides healthcare cost data, showed that properly managing a chronic illness could save you thousands a year before you retire. As of 2012, about 117 million people — half of all adults in the U.S. — have at least one chronic condition, such as heart disease, type 2 diabetes and obesity, according to the Centers for Disease Control and Prevention. Being sick costs money: 86 percent of the $2.7 trillion spent annually on healthcare comes from individuals with chronic and mental health conditions, the CDC found. "The average person will not always take their medications; they don't follow the protocols," said Ron Mastrogiovanni, CEO of HealthyCapital. "These little things have an impact, and it could be thousands of dollars." Here's how you can trim your medical bill by keeping your health in check.

Well-managed care

HealthyCapital examined a case study of a 45-year-old man with blood pressure of 150/95, which means he has hypertension. He forgets to take his medications at times, and doesn't always follow his recommended diet plan. This individual can expect to pay annual out-of-pocket healthcare costs of $2,477 at age 45 if he continues along this path, according to HealthyCapital. (Click on graphics to enlarge.)

In all, this patient can expect to spend a total of $138,288 in out-of-pocket expenses before he retires if he doesn't change his ways. On the other hand, if this same individual were to take his medication per his doctor's suggestions, exercise for 30 minutes a day, and slash his fat, salt and alcohol intake, he would spend $1,286 on out-of-pocket healthcare costs at age 45. Meanwhile, pre-retirement out-of-pocket expenses would total $72,591 if he dials back his bad behaviors, HealthyCapital found. This adds up to an average annual healthcare savings of $3,285 before he retires. In other words, this hypothetical patient slashes out-of-pocket costs by nearly $90,000 if he keeps up his healthy habits through retirement. The man in the case study also adds three years to his life expectancy due to these changes: He may live to see his 87th birthday.

Better health, lower costs