2001 nissan sentra idling rough, bucking if you maintain speed

I recently picked up a 2001 Nissan sentra. This car sat since around 2010. I guess the previous owner had a lot of work done by the dealer a year or so ago and it looks it, brake pads etc. are brand new, a couple other things look new but he’s not a car guy in the slightest and can’t find the receipt nor will the dealer give him one due to computer system change and I actually tried with them myself, that’s correct.

Anyway, the check engine light is on and bringing it home we had reports of black smoke out the exhaust. It also felt like it wanted to stall at times when stopped but it never did. Well, I ran it a while and at times it seemed like it wanted to clear up, at others it didn’t but the light stayed on and what not. I scanned it and it claimed the O2 sensor 1 bank 2 was bad so I replaced it.

It didn’t make any difference so I cleaned the Mass Air flow sensor. Again no good it’s the same. Here’s the funny thing though, it’s great first thing in the morning usually. As the day goes on and as we drive it, it gets worse. Does anyone have ideas what I can try/change next? I really don’t have money to keep throwing at this thing though if I have to keep trying things I will. It’s cheaper so far than taking it to someone which I also can’t afford.

I’m almost leaning on electrical issue where it gets worse as the day goes on and dew dries off. I’m new to Nissan’s, I like the car and really want to work this issue out. I did replace the fuel pump when I got the car, and have run sea fome through and actually on that tank of gas it ran pretty good but that’s worked itself out now. Suggestions welcome, I hope it’s not the computer.

Gas tank needs to be dropped and cleaned, or replaced if a thorough cleaning isnt possible. New fuel filter as well. Car sat for a long time, this is a classic problem with old gas, especially ethanol.

So, which is it???

Sorry, it was a long weekend. It gets worse as the day goes on.

The tank was cleaned when I replaced the fuel pump. I thought at the time, the dealer changed the filter a year or so ago when they worked on it but after seeing how bad the air filter was, I have my doubts.

Black smoke out of the exhaust is a sign of the engine burning too much fuel. I doubt it had anything to do with the fuel pump or filter, but it does not hurt to change the filter.

I would focus on plugs, plug wires, air filter, fuel injectors, oxygen sensors.