Tough call, take this with a grain of salt as I am newer myself, but I was told by a friend I trust to give each plant 2 foot of space. So if you draw an imaginary 2' by 2' box around each plant thats how much space you should allow.
My rough estimate would be... under a 400w HPS you should get decent coverage for a 3'x'3 lit area. And mediocre for 4'x4'. So I'd say you could fit 4 plants in 5 gal containers if they were trained properly (meaning pruned, tied, trimmed, LST'd or what not to fit in that provided area).
3 plants might be a bit better fit..also it depends on your strain. Is it tall, bushy, does it have much lateral branching, etc?
Hope this helps!