Turn off your high beams when driving behind a vehicle at a distance closer than:

When driving in the dark, high beam headlights should be used any time there are no other nearby vehicles, weather permitting. Switch to your low beam headlights when following another vehicle at a distance closer than 300 feet.
DMV Writen Test