Now this should be what is the passengers side main O2 sensor on yours as the engine is of Japanese origin the R/H cylinder bank is the leading bank. Main O2 (sensor 1) is on the exhaust manifold. Remove this and look closely as you will find the part no stamped into the base of it (Toyota are good like this) or go to
www.toyodiy.com and choose parts reference then enter your VIN then spend hours finding the correct part. Once you have the OEM part no for the sensor most aftermarket parts suppliers should be able to cross it over and it should be a 4 wire sensor..
Keep in mind the following.. What I would do first is clear the code and see if it re-occurs as a bad fill of fuel or a missfire can cause this. Crook O2 is likely but wiring degradation is not unknown yet I would expect this more from 20 yr old wiring.