(CNN) - Life as a 340-pound man had become unmanageable for Eric O'Grey.
When he wasn't traveling for work as a salesman for GE, the 51-year-old rarely left his San Jose, California, apartment.
He took insulin for type 2 diabetes and about 15 other medications, including anti-depressants and weight-loss drugs.
"My entire life was an exercise in minimizing my movement. I just felt miserable all the time," O'Grey told CNN. "It's just amazing how painful it is to be that heavy. Every part of your body hurts. My cholesterol was 400, which is the walking dead level."
He tried dieting, but nothing worked. Then two things happened seven years ago that inspired him to go see a naturopathic doctor.
O'Grey had an embarrassing incident on a plane when the flight crew had to wait for a seat belt extension for him before taking off. And he saw former President Bill Clinton on the news talking about his new "plant-based" diet.
The doctor recommended a whole foods, plant-based diet like Clinton's. She told O'Grey to throw out everything in his pantry that wasn't on her list.
But she also said something that shocked him. She ordered him to adopt a shelter dog and walk him twice a day for 30 minutes.
"I said, 'Why a dog? Can I adopt a cat instead?' She said, 'Have you ever walked a cat?'"
Eric went home armed with new recipes and an order to visit his local animal shelter.
He went to the shelter with visions of the perfect dog dancing through his head, one that never barked or shed or disobeyed commands.
And then the adoption coordinator brought in an obese dog with skin problems.
"His head was hung low and he wasn't even looking up. He was just obviously depressed," O'Grey said. "The dog looked up at me with a clear sense of disappointment I'd never seen on any person or creature."
The adoption coordinator told him they had a lot in common and both needed to work on the same things.
"'You told me you want to lose weight and get outside more," she said. "This dog needs the same thing. So this is the dog that I am recommending for you."
O'Grey took the dog home and named him "Peety" after the pup in "The Little Rascals." And they began going on walks.
A bond is formed
At first, O'Grey could only take his new sidekick about 100 yards before he'd turn back, huffing and puffing and embarrassed.
But Peety seemed to like it.
"He just looked up at me like he was so appreciative."
Their twice-daily walks gradually got longer as Eric began to enjoy his strolls through a neighborhood he'd never explored on foot before.
And Peety, with his striking white and black markings, was a great conversation starter.
"I called him my weapon of mass seduction because everybody wanted to meet him," O'Grey said. "We would walk around town and these women would say, 'Hey, do you mind if I pet your dog?'"
As they lost weight and grew healthier together, the pair developed a tight bond.
"I decided to become the person who he thought that I was. And over time really every part of my life improved," O'Grey said. "I was so reclusive and removed from society at the time that I needed a relationship in my life.
"It turned on certain emotions in me that I'd never really felt before."
From couch potato to marathoner
In less than six months, Eric quit all the medications he was taking.
He barely knew how to boil water, but he learned how to cook the spicy, vegetarian recipes his naturopathic doctor gave him.
"I really began liking my new foods much better than my old foods," he said. "My palate changed entirely and I started craving spicy foods."
And in 10 months, he dropped from 340 pounds to 185 pounds.
Eric began going on dates for the first time in 15 years. He had so much extra energy with his leaner body and healthier diet that he joined a club of runners.
"I was bouncing off the walls, I just had more energy than I could handle," he said.
Over time O'Grey discovered that he loved long-distance running. Today he runs an average of five to six marathons a year.
But he's quick to emphasize that his weight loss didn't come from running. Healthy eating and two walks a day with Peety did that.
In March 2015, Peety died of cancer. O'Grey calls it the "the saddest day of my life."
A new exercise buddy
Today O'Grey lives in Boise, Idaho, where he cooks up dishes like vegetarian paella with purple carrots and marinated tofu. His kitchen has large bins of exotic spices.
He is an evangelist for three things: cooking with fresh veggies and lots of spices, long-distance running and dog adoption.
Five months after Peety died, he found solace by adopting a new exercise buddy. Jake, with his shiny black coat, lean frame and boundless energy, is a good match for the new, healthy Eric.
Last year O'Grey rekindled a relationship with his high school sweetheart and got married.
It's been seven years since he started his journey toward a healthier, happier life. He is 58 years old but he says he feels more like 25.
He's co-written a book, "Walking with Peety: The Dog Who Saved My Life."
And for others struggling with obesity, Eric offers this encouragement.
"It's never too late to turn it around," he said.
Copyright 2017 by CNN NewSource. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.