its built into your truck. turn key on. turn off. turn on. turn off. and turn on and leave on. codes will flash out at you. but they mean much of nothing.
if the transmission either gets hot or thinks its hot, it may throw truck back into 3rd as a limp home mode.
this can be caused by a real fault such as a hot transmission. this can also be caused by circuit failures such as intermitant opens in the wires. an example would be hitting a bump and a loose connection looses contact. another example would be as the harness and engine warms up expansion and contraction causes it to lose contact.
this can also be caused by faulty sensors or other electronic hardware. if the temp sensor is going on the fritz it can give the pcm any number of faulty readings. same with the solenoids that control lock up and over drive.
with the intermittant nature of the fault, ones most likely to believe option number 2, poor connection that manifest itself only under certain circumstances.
instead of buying and replacing random parts only to get mad and blame it on the truck, do your self a free favor.
inspect the wiring harnesses that lead to the transmission. UNPLUG each connector. inspect for corrosion at the terminals or broken retainers on the connector. inspect the wires for cracks frays or breaks. follow the wires from the transmission (on the drivers side) up to the bulkhead/firewall. the will lead to the main harness that runs across the engine bay in the plastic loom. they continue behind the airbox/ac accumulator where you will find the main pcm harness connector.
i experienced similar problems, unplugged the transmission solenoid wires (3 pin connector drivers side transmission case) and plugged it back in. problem has not occurred since. at this time i had discovered someone ran a brand new single wire from the pcm pin 54 to the transmission, possibly due to a burnt factory wire.
you can completely bypass the factory temp switch by unplugging it and wiring in resistors. i dont have the schematics or details, but they float around here quite often.
the next thing to do is find out what your real transmission temperature is by installing an aftermarket gauge and a sender in the transmission pan.