First off, Make sure your cat is eating and drinking normally. Check the color of the inside of his ears, his gums and the whites of his eyes. Are they a nice healthy pink and white? or are they tinted yellow? If his eyes are not white and his gums and inner ear are nto a healthy pink or off pink coloration and have a yellow coloration to them, then take them to the vet as soon as possible.
Also, how are his poops and pee's? Are his poos a good normal consitstancy no diarreah? not grey or yellow? And are his pee's a good healthy yellow? If his urine is orange and cloudy/Dark orange, then he is becomming dehydrated which ties into the vomiting.
Sadly, vomiting and gagging are symptoms for ALOT of different feline illnesses so trying to find an over the counter solution may prove incredibly difficult. Do a thorough check over and make sure everything else is normal and then keep an eye on him closely. If he refuses to eat/drink, continues to mope or begins to hide then get him to a vet.
You can also give your local veterinarian a call as well and ask for some advice as well.
You could try an over the counter wormer med. If The problem persists after three to four days, I'd take him to a vet. It's likely a stomach parasite of some sort. This causes the gagging and throwing up (trying to remove the parasite, will keep failing). If not for the other behaviour I'd suggest hairball remedy, but that wouldn't affect their mood and energy level so drastically.