I've fixed this many times, yellowed, hazed, flaking ect on headlights. Depending on the severity I will start with anywhere from 800 wet on a d/a to 400 dry on a d/a and step it back out to at 800 wet. Then re-clear the lights. You can do with with any automotive lights, Ive done it on porsche HID's, audi, landrover, mustangs, ect. Insurance Companies love NOT having to buy a $1200 Saab HID light when I can sand the scratch out and re-clear the light to look like new. On the taillights you can add some black base to the clear to tint the lights, the more you add the darker they get. Or if you just re-clear the taillights/marker lights they will look like new.
Mine were doing this too when I got the car. They were not too bad, but i just started with some patience and 0000 steel wool. Don't get too crazy pressing down or it will be a little harder to get the scratches out. PATIENCE DANIEL SON! A little medium cut 3M compound helps to cut it too. Tape off the rubber around the edges or it will get scuff marks on it and the bumper cover if you leave the headlight installed. After getting the flakey stuff off I went just a little longer to make sure. Then buff the lens back to a shine with a random orbit buffer. Mine look like new except up close to the rubber where the buffer can't get that well. Those spots will take a little hand rubbing and elbow grease.
Frog's approach works well too. In both cases make sure there are no contaminants such as dirt or tar on the lens or sandpaper. Those scratches produced by the dirt are very hard to get out of the plastic.