I would expect the TPS sensor to throw a code if it were bad. Doubt the shifter module would prevent the engine from running over 2k rpm. Sounds more like a wiring problem somewhere, bad ground, shorted O2 sensor or wire, corroded battery connection, etc. Any recent work done on the engine that might have messed up wiring? Does the engine sound normal but just not rev more than 2k rpm or does it misfire and die? I believe 07 was the first year for drive-by-wire on the 3.7 engine.
06 Laredo - 4x4 V6 - Stone White - Custom LED Cargo Area Lights, Lighted Visors Added - now at 49k miles
97 Laredo - 4.0 4x4 Daily driver for 8 years then relocated to Arizona for 6 more years with the relatives