1987 Toyota Pickup

Engine problem
1987 Toyota Pickup 4 cyl Four Wheel Drive Manual 182000 miles

My pickup will start fine and idle fine at about 650 to 700 rpms. After I drive for 5 to 10 minutes, or just let it sit and idle the rpms begin to drop. If I turn my headlights on the rmps drop by about 100 rpms and the lights dim. When the lights are on and the car is warm it idles between 500 and 400 rmps. I replaced the spark plugs and wires. The battery is fine. Was thinking maybe an egr valve. Any ideas would help, Thanks.
January 29, 2008.

If it was the EGR I don't think it will idle at all-all that dilution no way jose it'll idle erratically.

Lets try the idle air control valve clean it out/air bypassages and also the throttle plate-won't hurt to check the throttle position sensor closed and wide open throttle voltages-

Let me know when you need more help

Jan 30, 2008.