Had codes read, said need 02 sensor, replaced, had codes reset, light comes back on. Tried new gas cap. Light still on.
Apparently the problem isn’t with the sensor itself. It could be with the wiring to the sensor or something else. It would help us to know what the actual code(s) is.
I must be missing something here. You changed the gas cap when you got a code that said you have a bad O2 sensor?
OK, then what did you do? This is a short story, isn’t it? "It was a dark and stormy night, and all through the house, the clock struck 10, etc."
what were the codes that came back?
Give us more to go on. Make model and year of car, auto or manual and what code was stored the first time and is it different now? Codes should be in the format of P1234.