All fish have limited lifespans an 5 years is pretty good for a Betta. They can be fine one day and then the old age symptoms seem to come on all of a sudden. I don't think you can do anything to prolong his life as medications will probably only weaken his already weakened state further. It is sad when fish reach that stage but I really don't think you can do much for him. Sorry.
it looks like body rot to me, fin rot that has progressed to the body. fin rot can be caused by poor water quality. you can treat it with an antibiotic like furan-2 and keeping on top of water changes but i don't know if it'll actually get better.