The oxygen sensor is replaced for free in the USA only when the vehicle reaches it's first 80 000 miles regardless of the age & number of owners as stated in the factory owner's manual in the maintenance section,some Toyota dealerships are reluctant to replace it for free if that happens contact the Toyota regional head office for your region where they will give your local dealership 48 hours to comply.
On average the oxygen sensors should be replaced every 6 years or 100 000 miles or so which ever comes first as stated in the owner's manual,warranty booklet and factory service manual.
Symptoms of a bad o2 sensor are poor gas mileage,hesistation in acceleration,worse emmissions,and in severe cases after the stat opens the engine can no longer maintain stable 750 rpm (with manual 5 spd tranny) idle and the engine begins to stall.
The 02 sensor is designed to function once the vehicle has warmed up which is about after 10 minutes where the thermostat begins to open at 190 or 195 degrees Ferenheit depending on thermostat then the vehicles ECU system enters what they call a "closed loop system" then the exhaust manifold's temperature reaches 400 degree Ferenheit (I think)that's where the sensor starts to do it's job which is usually when the thermostat first opens up then the oxygen sensor senses the ratio of air to fuel and sends a signal back to the ECU then ECU compensates by increasing or decrease the open time for the fuel injectors to pump fuel.So usually the problem of stalling shows up after about 10 minutes of driving or so.Many folks think that the o2 sensor is bad but an exhaust leak can cause excess oxygen to enter the exhaust system thereby fooling the sensor into thinking there is too much oxygen,there are other problems that could cause it to give false reading such as a vaccuum leak.
If you discover that the o2 sensor is bad and it is not under warranty then from my/others experience/research purchase an o2 sensor in the following order:
1)Toyota (NipponDenso now called Denso)
2)Denso aftermarket (Same as original but sold aftermarket)
3)NTK (oxygen sensor division of NGK)
(10% shipping by Fed Ex or free shipping with $100 & over speak to Roger at 1-888-271-3948
Repairs tv's,vcr's,home/car audio out of my home
1985 Toyota 4-Runner,solid front straight axle,factory cruise control,sunroof,22R-E,W56,RN60LV-MSEK,rusted rear step/towing chrome bumper with 249 000 KM