stephen;
From the description, the engine runs fine when it is in open loop mode, but not in closed loop. Your description has something to do with the O2 sensor readings that the ECM (Engine Control Manager) sees. If you have the computer software program, the handset with the software program and the interface cable for the truck, look at the O2 readings. But, if you don't have these items find a good OBD II handset. Under the dash after the cup holder is lifted out, you will find the blue OBD II plug. This may give you an answer to what is wrong.
This is ONLY to be used to report flooding, spam, advertising and problematic (harassing, abusive or crude) posts.