The primary function of the Oxygen sensor or O2 sensor is to aid in the smooth operation of engine by detecting suitable air to fuel ratio and thereby ensuring fuel efficiency.
It is positioned in the exhaust pipe of most cars manufactured after 1980.