Summarize this article:

Guinea pigs are social creatures, so if you have more than one, you should avoid separating them when one is dying. Doing so could make both animals anxious or sad, and this is the last thing you want to do as your guinea pig makes his grand exit. It might be a good idea to separate your ailing guinea pig from his friends if he is in pain or the other guinea pig tries to rough-house with him. You will need to make this judgment yourself based on the situation. Placing a small, light-weight blanket or piece of soft cloth on top of or around your guinea pig will keep him from getting cold and will help him relax. Your guinea pig may become incontinent as his bodily systems begin to shut down, so change out the blanket every so often to keep your pet reasonably clean and comfortable.  Many animals (and people) are much more sensitive to cold as they age and begin to die, so keeping your older guinea pig's cage environment slightly warmer than you used to can improve his comfort substantially. Use a material or cloth that your guinea pig is familiar with to enhance his comfort with the situation. A dying guinea pig will become very weak and unable to feed or water himself as his death approaches. You can make his passing less uncomfortable by offering him water from a spoon, syringe, or water bottle. Blend or mix a guinea pig "smoothie" that contains hay, water and ground up pellets and feed it to him.  Don't force your guinea pig to eat or drink if he doesn't want to. You simply want to make these things accessible to him if he can't get them himself. Make sure anything you feed your guinea pig is well-blended so he doesn't have to use up precious energy chewing (which he might not be able to do, anyway). You can gently cuddle or stroke your guinea pig to comfort him and express affection. This will help your guinea pig know that he is not alone and should reduce any fear or anxiety he may be experiencing. If you hold him, do so in a way you know he likes and that won't cause him any unnecessary pain or discomfort.  Many guinea pigs like to have their foreheads gently stroked. If you know your pet enjoys this, do this as he passes away. Take note of any body language or noises your guinea pig may be making and adjust your physical contact with him accordingly; don't do anything that causes your pet pain. Your guinea pig will be most comfortable in warm, quiet space with lighting that is neither too bright nor too dark. Soft, pleasant, natural sounds (such as birds singing or the babbling of a brook) may be comforting to your pet. It may also be best to give him some space toward the end so he can slip away peacefully. Check on him often to offer food and water.  If there is a specific toy or other item you know your guinea pig is fond of, place this object next to him. The simple presence of items he enjoys may provide your pet a sense of calm. Treat your dying guinea pig as you would a sleeping baby; anything that is likely to wake a snoozing infant will probably also be unpleasant for your pet.

Summary:
Keep him near his companions. Wrap him up. Help him with basic needs. Show affection. Provide a peaceful atmosphere.