Calculate transistor params as switch to operate within the maximum limits safely
If you're using Fairchild's transistors, anything can happen, they measure the [base] current in volts, so who knows what they put in those packages, chewing gum maybe?



If you're using something less silly, like ON's datasheet



then we can start thinking about this. Your base current is nowhere near 150mA. In fact it's at most 5mA so the much lower first line should apply, so the saturation voltage shouldn't get so high [because of that]. And ON's datasheet also has pretty graphs on this 



But in fact, in your circuit Vce does get high, but because you're not giving it enough base drive, i.e. you are barely saturating the 2222 transistor. I get a beta of 90 in LTspice simulation with those resistor values you have, not the forced beta of 10 this BJT should have when saturated (according to its datasheet). Ok, it doesn't get that low for me either, but you're too left of the sweet spot. A base resistor between 500 and 700 ohms should be more reasonable.



You could in fact us a base resistor as low as 300ohms here. If you go below that,
the power dissipation in the transistor actually starts to go up, due to the base current.

Pay close attention to order of colors in the folloing graph (as alas LTspice 
doens't have a more decent way of identifying stepped data). [Forced] beta keeps going 
down to about 12 at 100 ohms base resistor (magenta line), but the power disspation in the transisotor bottoms on the red line (300 ohms) and slighly goes up after that. The base resistor power dissipation increases consideralbly too after that. Also, whatever your 5V source is (uC?) might not be able to actually drive it with high of base current.



Another interesting thing to note is that the base current is around 15mA when the sweet spot (for power dissipation) is reached at 300 ohms base resistor... pretty much like the ON datasheet suggested on that first line.



Below I've used a behavioral resistor to vary the base resisotr over time instead of using step. You can better see the curve that power has this way... but the value of the resistor is not that obvious. It goes from 10ohm (left) to 1.01Kohm (right).



Also, beware that the thermal resistance (to air) of the MMBT2222 varies quite a bit with the manufacturer (well at least in datasheets). Fairchild gives 357 °C/W, NXP 500 C/W, ON gives 556 C/W. Even with the latter, at 150mW (for a 300-500 ohm resistor) it should survive, but would be very hot at around 85C. Max junction temp is the usual 150C in all these datasheets.



Regarding the 2N3904, that one has a higher thermal envelope of 625mW (in TO-92) but the die of the 2N3904 (or MMBT3904) can only take 200mA collector current. So what happens with that one is that the junction gets destroyed by the excessive current density (you're giving it over 400mA collector current), and then the thermal limit is exceeded so the package goes up in smoke.

The selection process is basically:


Check that the transistor model can handle the load = collector current. (Well, you also need to worry about the CE [stand]off voltage, but that's not exceeded here.)
Then figure out the base drive (=resistor) needed to get a low Vce(sat)... so that its power dissipation (SOA=safe operating area) isn't exceeded either.