pull the negative side of the battery cable off and see if the engine dies. if not then with the negative battery off, have some one turn on every thing in the truck, if it still don't die then its your battery or maybe a regulator problem. i hope this helps, i have done this many times.
"depending on the alternator. some have the regulator built in to them"
"and dealing with the charging system always be careful and take your time"
Alternator needs replacing.
replace the alternator
When you turn on the headlights of any car it causes a load (or horsepower drag) on the engine. Your car has an idle problem and the load on the alternator simply exacerbates it.
Probably an alternator.
If there are no CEL codes, disconnect the battery for a few hours and then re-connect.
Sounds like a problem with the idle air control valve. The battery would not cause this, as when the car is on the computer provides the power through the alternator. The reason it could be idle air control is that the computer increases the alternator output when current draw increases, which increases the load on the engine. Normally it also compensates for this at the same time by allowing more air into the engine, and it does so through a valve on the throttle body (or with the throttle itself in the case of an electronically controlled throttle) Check out your alternator and or voltage regulator! That's most likely what it is. A bad alternator would NOT cause the vehicle to stall. Neither would a bad regulator.
Disconnecting the battery is what resets the computer on this model year. Try disconnecting the Pos battery cable for 15 minutes. If the problem presists after connecting the battery up again, you have a problem with Idle Air Control, EGR Valve, etc.
Defective alternator.
It sounds like the alternator or regulator is breaking down under a load while driving. Make sure the alternator belt is tight, and check the regulator and alternator for proper voltage under a load.
Try retuning the engine. Luckily for an EFI engine this is as easy as disconecting the battery for a few minutes and then reconnecting. Start the car after retuning and see how it idles, hopefully it will fix the problem. Good luck! If the problem still remains, and when you give it some gas, it actually LOSES RPM, this may be a problem with the ECU/ECM, or a fuel problem (try draining a bit through the nipple on the fuel tube going into the injectors in the intake manifold).
i have a different make and model of truck, but had the same problem after jump starting mine after the dome light discharged the battery. I found in the Haynes manual that the ECM on the fuel injection might have gotten an error message causing this problem. After charging the battery, I simply had to disconnect the negative battery terminal for 20 seconds or so to clear the ECM and the problem went away. Alternatively in my truck, it could take up to 50 starts for the engine to clear itself, I refused to wait that long. Hope this helps, good luck.
Have vehicle scanned to determine the problem