I have a 2x2x5 tent with a 400w. It does get hot if you don't have any intake/exhaust fan.
However, if you get a powerful enough exhaust fan you can easily run a 400w HPS/MH. Keeping the air circulating is the most important part.
You can also get an air cooled hood which keeps the light cool.