I had the same problem with mine. Couldn't pass inspection. After the o2 sensor, maf clean, and new catalytic converter I checked the ignition coil. Can't remember which now, but one of them was bad, either the primary or secondary. Truck ran ok with a bad coil but I guess it has a hard time cooking all the fuel when you don't get a good spark.
Anyway, it was a combination of all these things that worked for me.