An air-fuel ratio in the lean range is detected by measuring a limiting current when oxygen diffused to a first electrode is pumped to a second electrode via a solid electrolyte. A stoichiometric air-fuel ratio is detected from electromotive force between first and third electrodes when oxygen is pumped from the first electrode to the third electrode. The invention is characterized by use of such three electrodes. Furthermore, an air-fuel ratio in a rich range is detected by either sending oxygen from the first electrode to the third electrode via the solid electrolyte and measuring a current when the electromotive force between the first and third electrodes is controlled to be constant, or measuring a current when the air-fuel ratio range is judged as "rich" from this electromotive force and the polarity of the impressed voltage at the time of lean detection is reversed.