Lots of parents report that their children "refuse to eat," usually beginning in early toddlerhood and often lasting for two or three years. It's a completely normal stage, and by itself is usually pretty harmless (though less than ideal from a nutritional point of view if they're filling up on sugary or fatty snacks), and in spite of their parents' deep anxiety, their kids aren't usually wasting away. They are just very, very particular about what they would choose if left to their own preferences.
It's so common that some development experts think it may be a way for kids not to poison themselves by sampling every plant and bug that they can get their little fingers on. It's also common during normal periods when growth slows down for a month or two – the appetite is simply smaller then.
Understandably, parents get anxious about their children not eating enough, which often leads to mealtime battles, which in turn can lead to long-term food issues, up to and including serious eating disorders. An unfortunate few toddlers are cursed with eating problems that do call for medical intervention, often associated with sensory integration issues. Have you considered, with the gagging, whether this could be a problem for your son? Kids this age can be genuinely disgusted by certain flavors and textures, and that reluctance to try various foods can last for several months to a few years. Imagine being forced to eat something you really hate…
My 5yo grandson wasn't much of a mealtime eater until a few months ago, and usually had only the scantiest appetite by the end of the day. Dinners were often his smallest meal, and he doesn't suffer from hunger through the night. But during the day, he was usually willing to "graze" on high-quality snacks, overall quite a healthy diet, actually. His preferences can shift quite a bit from month to month, and are most likely signaling that his body needs more of certain nutrients.
We've also noticed that if he doesn't get to eat right when he feels hungry, the feeling will often pass and he'll have absolutely no appetite when dinner is ready 25 minutes later, even though he's showing signs of low-blood-sugar, like irritability.
Many kids are much better grazers than mealtime eaters, and that's actually a fairly healthy and natural way to eat. They can grab a few attractive/nourishing bites right when they are feeling hunger. You might consider trying that, along with having him sit with you for a SHORT period at meals to maintain a pleasant family bond.
It's completely normal for kids' appetites to disappear completely for days at a time, and for them not to be hungry for certain meals. Making kids eat foods they dislike, or any variation on the theme of force-feeding, makes for an unpleasant mealtime experience, which further kills appetite. It also teaches some of us to eat when we're not hungry, which can become a very unhealthy habit later on.
My best to you. Keep in mind that some kids just grow up skinny, and for their particular body types, that may be the healthiest possible situation. Talk to your pediatrician about your concerns – he/she will be able to tell you if your son's weight is reasonable for his height.