This behavior is completely developmentally NORMAL and not at all strange! It is absolutely an attention getting behavior- at 2 years of age, attention is attention wether it is positively or negatively driven. This is in no way a testament to anything you are doing or not doing, but a clear case of your son testing your limits.
He has realized that his vomiting and gagging himself illicits a HUGE reaction out of you: no one likes vomit, especially the voluntary kind! The key to getting rid of the behavior is making it clearly known what the consequences will be if he DOES throw up, and then following through calmly EVERY TIME. Under no circumstances should you reward him for unwanted and inappropriate behavior - there should be no stickers. In this case, choose something that is important to him - tv time, dessert, that weekly trip to the park (SOME privilege or item that is meaningful or important that is NOT his security blanket or binky) and take it away when he makes himself throw up. The letting him sleep in it deal is GOOD, and you should still make him sleep in his vomit when he does it - but also make sure that he knows that, if he makes himself vomit, he will lose that agreed upon privilege the next day. Every time he does it, he loses something else: you have to make the cause and effect VERY clear - and follow through EVERY TIME.
The behavior may get worse before it resolves itself as he will want to test just how far he can push you before you give in. When he starts in with the gagging, remind him that if he vomits he will both sleep in it and have something taken away the next day, and if he continues - just leave the room. If he starts in the middle of your bedtime routine, cut it short and be done with it - do not give him the attention and feedback he is looking for.
My daughter did this too, and occasionally does it still when she throws a temper tantrum. Don't let him see how much it stresses you out - thats just fuel to the fire!
*Just as an edit, there is NOTHING neglectful, abusive, dangerous or mean about making him sleep in his own voluntary vomit. Really. Dont beat yourself up over it for a MOMENT.