Annoying check engine light & minor problem won't pass emissions test

It is possible that the first mechanic used an aftermarket O2 sensor that is not an exact match for the application, or the replacement sensor might actually be defective. I would start with that.

If the code pulled is a P0420, which seems to be common on Corolla’s, then I wish you the best of luck. The first thing that mechanics jump on for this code is the catalytic converter, and most of the time it doesn’t fix it. More often, the second O2 sensor, the one behind the cat will solve it, but not always.

My daughters Corolla has this problem, and so far nothing has worked. A co worker had this with her 09 Corolla. It took many visits to the dealer to get it fixed, but the dealer will not say what they did to fix it and did not supply a repair receipt for that last visit.