Directly copied from my post:
I got a P0171 on 2003 Corolla. That morning the temperature dropped. But except for the check engine light, I didn't notice anything abnormal.
I replaced the intake manifold gasket and cleaned the MAF sensor. After erasing the code, I've driven about 50 miles and according to my OBDII scanner, all the monitors are "ready". Hopefully the light will not come back.
For the intake manifold gasket, I found this website helpful:
http://toyota-solutions.blogspot.com...a-corolla.html
In addition to the instructions above, I also disconnected three pipes to set aside the throttle body, two on the top and one at the back(my rate-limiting step for removal and installation), and removed the 2 clamps of the engine wire from the clamp bracket. All the other tubes and wires remained attached. The old black gasket was solid as a rock.
Oh, one more thing: if you are using the Actron OBDII reader, be careful as the bottom of the adaptor may be stuck to the port on the car. In that case, don't simply try to pull it off. I've spent some time cutting a small portion of the adaptor.