Normally, as the outdoor temperature falls and headlights cool off after the engine is shut off, damp, cool air filters into headlight housing vents. As the outside temperature rises, the condensation evaporates.
However, when vents are particularly small, condensation does not always evaporate as it would under ordinary circumstances. Other contributing factors to lingering condensation are loose bulb covers and vents blocked by spider eggs, dirt and other debris.
The best way to prevent condensation in headlight housings is to remove bulb covers, check for clogged vents, clear vents if necessary and replace the bulb covers, making sure they are properly lined up and snugly in place.
It also helps to park a vehicle with a tendency toward headlight condensation in an area that is dry and warm, whether that is in a garage or in an area away from trees and other objects that create shade.