If an O2 sensor is it will it always turn on a check engine light on 2003 Ford Taurus

The thing is when I start reving at about 5000 my car trys to shut off but I think it is an O2 and how many are there anyways?
And it also starts doing the same thing as I am slowing down almost as if it doent know how much gas to send to the engine.
The mechanic said one O2 sensor wasn't working properly but I dint want anymore testing because it was costly

3 answers
Why are you hitting 5000 rpm?
agree get diag codes to proceed. there are test procedures for each circuit on o2 sensors
Testing is a lot less costly than guessing! That is all we can do without some test info. Did you get any trouble code numbers for the check engine light from the mechanic?