Use your hand to test the heat of the lamp. Put the back of your hand under the lamp and slowly move it away until you get to a comfortable distance that isn't too hot.
If it's too hot for your hand it's too hot for plants.
I would say keep it at about 18 inches to 2 feet away, but some people have a 400w as close as 1 foot away from the plants. This is OK if you have good cooling system.