Welcome to 2CarPros.
What you describe sounds like the transmission is slipping. Is the fluid clean and full? Other that the P0171, have you gotten other codes?
The code you have indicates a lean fuel mixture which can be caused by several things. Things such as low fuel pressure, faulty or dirty injectors, and engine vacuum leaks can cause it, but that shouldn't cause the increase in RPM's you described. Also, the IAC or MAF wouldn't cause that. Since it is happening when the vehicle is in gear, the transmission must be slipping or losing pressure and disengaging a gear.
Let me know if there are any other codes and the condition of the transmission fluid.
Take care,
Joe
SPONSORED LINKS
Wednesday, March 6th, 2019 AT 2:46 PM