J.S.
I had this EXACT same thing happen to my daughter. It's a virus. This is how it went.
Monday she woke up in the middle of the night throwing up. By Tuesday she was fine, in fact she was fine all week till, Friday. Then she started again, just at night. During the day she was fine, eating drinking, playing, seriously fine. She was a little grumpier but because she had lost sleep.
So Friday and Sat she wakes up throwing up. Sunday, Monday she was fine. We were getting ready to fly home the following week, so when Tuesday she threw up again I took her to the doc. He was completely stumped. Thought maybe she had acid reflux because she was only throwing up when she laid down. He told us to start giving her gas drops before she went to bed at night. So we did, but she threw up again on Thursday. We flew out Friday, and luckily she only woke up sick one night during our stay there. But she was, completely cranky for the first couple days.
But when we got home she threw up two more nights in a row. Now we were going on nearly a month of really inconsistent sicknesses. We had monitored her diet, her drinks, everything not one single thing was consistent.
Then just as quickly as it came on, it stopped. Like you I started asking around and a bunch of people told me their kids had the same thing. It just seems to be a really odd stomach bug that was going around. Hopefully your little guy will follow the same route and will be fine soon.