Hi
BIG HUGS
I am very sorry to hear this. My thoughts are with you.
Pneumonia is generally not considered to be painful but please also consider that a guinea pig whose body is closing down - not always quite smoothly - will pretty soon stop being able to process any oral medication so please do not beat yourself up over having failed your boy.
By the time your boy was looking uncomfortable from organ failures, it was likely already too late for any meds to be processed and to make any difference. You have done all the right things in order to make him as comfy and to keep him warm while his blood circulation was breaking down. You have not failed him in any way. I am just sorry that it happened very fast. It takes experience to spot the initially often very subtle signs of a natural death when you have never encountered them before or have witnessed a passing.
Please try to take comfort in that he could pass away carried by your love in his familiar surroundings. Pneumonia that doesn't react to medication, especially in older piggies, happens when the lungs are the first organ to give and is also one of the most common ways humans die a natural death from old age. We can unfortunately not stop nature and time - even less so in guinea pigs when their much faster metabolism turns against them.
It is your good care that has given your precious boy many years of happy todays, which is how guinea pigs measure a good life by. Please try not use sight of that against the last few hours of a natural death, which is a one-way process nobody can stop once it has started.
It is our human species wiring that we reflect everything back onto ourselves and that we all suffer from feelings of guilt or intense soul-searching at the onset of the grieving process. It is not an expression of failure but how deeply we love and care and how traumatic the circumstances of a passing are.
We are here to support you through end of life/bereavement times as a community if you wish to.
Here are some links that may help you make more sense of your experience:
Is My Guinea Pig Dying?
Human Bereavement: Grieving, Processing and Support Links for Guinea Pig Owners and Their Children
Looking After a Bereaved Guinea Pig