As any car owner knows, plastic headlight lenses degrade over time and get foggy or hazy, both inside and out. The outside is prone to damage from road debris, sandblasting from bugs and dirt, and general degradation from UV light and oxidation.
Inside there is less that can affect them, but the UV from the bulb itself is enough, as well as moisture from bad gaskets around the bulb socket. Fixing them, despite promises to the contrary from many products, involves labour and abrasives.
Obviously to fix a foggy lens from the inside you will have to remove the housing and access it from the rear.
Wash and Wax
Like a lot of car appearance and maintenance tasks, it helps to start by washing the car. This way you get a much more accurate idea of exactly what you are dealing with.
Wax the car as well, including the headlights; this may actually vastly improve the fogginess. The abrasives used to fix headlights can ruin paint, so you want to mask around the headlight as well before you move to the next step.
Sand
How coarse a grade of sandpaper you start with depends on how bad your lenses are. You actually may get away with skipping this step and moving right onto the polishing compound if they aren’t too bad.
Typically you start with 1000 grit wet/dry paper, and a small bucket of water to dip it in. Sand smooth, then move up to 1500 grit, 2000 grit, 2500 grit, and 3000 grit.
Some restoration kits make this easier by including an attachment that fits in your drill and does the work for you.
Discover how to replace the headlights on your specific vehicle
Polish
The polish that you need to use on headlights is specially formulated for plastic and contains abrasives, so don’t get it on your paint. Some people have suggested toothpaste can be used, but it doesn't work as well as a dedicated polishing compound or plastic polish. Rub it on, polish the scratches left from the sandpaper, and wipe it clean with a damp rag.
When you are done with this step you should have an almost new looking headlight, but it would stay that way long without the last step.
Seal
The last step, and most important for long lasting crystal clear headlights, is to apply a clear UV and oxygen resistant coating. Some of these wipe on, and some spray on, but all of them work about the same. It is basically a clear paint that seals the plastic from reacting with the oxygen in the air or UV rays from the sun.
Even with the cost of the needed supplies and the labour involved, restoring headlights is much less expensive than buying new headlight housings on most cars. Popular Mechanics even did a comparison test of a bunch of kits and ranked them for you here.