Acceleration Sticking & Dies at Stop Signs

I have a 2000 Nissan Sentra GXE that particularly the first time I drive it after it has been sitting all night, won’t get up to speed. It will get to 20 or 30mph and stick. Sometimes I will get more rpm, but sometimes I won’t.



After exiting the freeway, it dies at the next red light or stop sign.



If I am idling and I turn OFF the air conditioning, it dies.

Correction - its a 2001 (not a 2000)
To be more specfic on the power issue, it will shift into 2nd and 3rd roughly (at a higher engine RPM and jerky conpared to normal). It really struggles to get into 4th, even reving the enginer RPM’s up high. The oddest thing is that when you are trying to get up to speed the engine just drops off like you took your foot off the accelerator. You can pump the accelerator to get it to kick back in but never seems to “catch”.

When was the last tune up, new spark plugs etc.?

I think it has been 2 years, but I can’t find the receipt.

There are no misfire codes. But a few weeks ago there was the following code:
P0171-System too lean[bank 1]

But the code is off now.