P0171 is Intake manifold too lean.

There may be leaks in the few black rubber hoses between the Air Filter box to the Intake manifold.

But most likely your Mass Airflow Sensor on top of the air Intake hose are dirty or defective. Swap in a known good DENSO MAS. All Toyota and Lexus use the same DENSO MAS. You may try to clean the sensing element with a non-residue contact cleaner, but this sensor sometimes are bad even if it looks good and passes electrical tests.

If not the MAS then there may be cracks or leaks in rubber air and vacuum hoses between the air box and the air Intake which are a pain to find.. Check all rubber hoses to make sure they are not cracked or broken, and all plugged in securely. If that does not solve the P0171 problem then you may have to blow smoke in the air Intake and look for leaks, a pain in the ass..

The 1ZZ engine is known for burning oil. A few quarts for 500 miles drive is way too high, may be caused by stuck piston rings or stuck valves due to oil sludge.. Try to clean the engine and get rid of the oil sludge by flushing with MOTOR MEDIC'S motor flush (Walmart $5). I would use half recommended strength, put half a quart in the engine, idle for 20 minutes then dump the oil and replace oil and filter. You should see the dumped oil black and thick like tar. Drive a few weeks then repeat the flushing a couple times to really flush out the sludge and see if it run better burn less oil.

My Celica GTS with 300K miles was running rough with low compression in CYL1 due to infrequent oil changes. Shops kept telling me there was no fix, I had to swap an engine. 2 motor flushes with oil changes later, compression was up high and even, engine ran smooth like new again LOL..

Dont let the stupid shops rip you off.
.