On average, bettas in captivity live to 3–5 years (once you remove the extremely high premature death rate due to poor husbandry/shipping/pet store conditions, and due to ignorance of many betta buyers). There are numerous recorded instances of bettas living past 5 years, with the record being 10 years.
Since pet shop bettas are generally about 6 months old, your betta may have simply passed away due to old age.
From your description, it is also very possible that he was constipated, which eventually killed him. Constipation manifests as bloating, lack of pooping, and lack of appetite. Left untreated, it can kill fish. Constipation can be caused by overfeeding and/or a poor diet. Fish in general do not need to eat a lot. You can feed a betta just a 2–3 pellets a day, once a day, and you can skip days too. Many aquarists will fast their fish one day a week to prevent constipation. Many aquarists will also feed their fish peas once a week (frozen peas that were thawed, shelled, and mashed) to make sure they have enough fiber in their diet. It’s a good idea to supplement pellets with other food, including peas and other veggies, and frozen and/or live foods like bloodworms, mysis shrimp, blackworms, brine shrimp, and wingless fruit flies. Pellets, even high quality pellets like those made by New Life Spectrum or Omega One, don’t perfectly replicate a natural diet.