Guinea pigs should never be left without a companion. If you have more than two already, if one dies it’s not essential to replace it. But you can if you want - the more the merrier, as far as the GP community is concerned!
If one of your two guinea pigs dies and for whatever reason you don’t want to get another, it's best to give your single guinea pig to a friend who already keeps guinea pigs, or, failing that, to a local pet sanctuary.
Check out the Introducing Guinea Pigs section of this guide for handy tips on getting GPs together.

Guinea pigs get very lonely, so always provide them with companions
Anyone who claims that their guinea pig doesn't enjoy the company of other guinea pigs is simply mistaken. All guinea pigs are herd animals, without exception.
When introducing new guinea pigs, it should be on a neutral territory. This means an area in which neither animal has spent a lot of time, and therefore doesn't feel territorial about. This could be a large cardboard, or an area of your house that's safe for the guinea pigs to nose around. This area should be big enough for the guinea pigs to meet without being forced too close together, as this could make them feel threatened and therefore less likely to bond.
Heidi, 4 September 2022
My guinea pig is almost 5 years old. I adopted her (Tilly) and her sister (Milly) at a couple months old. When they were around one year old, one of them passed away (Milly), and my remaining piggie was very lonely. Couple weeks later I got another piggie (Billy) and they got along really well, no issues whatsoever. However, my newer girl (Billy) passed a few months ago suddenly, so Tilly was again very sad, as was I as Billy was the sweetest girl ever. Two days ago I got another guinea pig, and they aren't bonding very well. Anyone have any tips on how they can both be happy?