Punishment, as such, is seldom needed when children are given productive ways of dealing with their own issues. It sounds like your little boy has some good reasons to be experiencing distress. His life has delivered some big, big changes, over which he has had no control. And 4yo's really, really crave control, choice, and autonomy.
Rather that give the message "X behavior is unacceptable and will get you punished," kids generally respond more positively and quickly to "I see by X behavior, you want/need more of Y. I really, really understand. I wish we could give you as much Y as you want. More, even! Now, would you like to go and have some fun with your friends? Figure out which toys you can share. If you don't want to do that, we can go home and have some quiet time now, instead. But I'll bet you'd probably rather play awhile, wouldn't you?"
My grandson never has reason to tantrum, and his acting out has almost disappeared since instituting this approach a couple of years ago (he's now 4.5). Though he does receive the logical consequences for his choices, punishment has virtually disappeared from his life – there's simply no need for it. His parents (and grandparents) don't have to coerce or manipulate him, or seldom even raise our voices, to get his calm, respectful, often cheerful cooperation.
If this sounds as wonderful to you as it is, I hope you'll google Emotion Coaching to learn more. Here's one very informative link to get you started: http://www.education.com/reference/article/important-pare... . There are also some terrific books working with these techniques. One of my favorites is by Faber and Mazlish, How to Talk So Kids Will Listen, and Listen So Kids Will Talk.