Get him to a vet, ASAP. It could be a few different things, bloat possibly being one of them. Not eating and weight loss are the first two critical indicators that he needs a vet.
If he isn't eating, you can use his pellets to make a mash and syringe feed it to him. Just soak the pellets until they're a consistency like slurry. Draw it up with a syringe and slowly feed it to him. Turn the syringe sideways in his mouth, DON'T squirt it straight in or you can choke him.
A guinea pig needs food constantly. A guinea pig that isn't eating is a guinea pig that is dying.