A modified simple discrete PI - based algorithmic approach for HEGO based closed-loop lambda air fuel ratio control of gasoline engines will be introduced for the first time in this paper. The modified PI algorithm provides very tight air fuel ratio control and has no unstable divergence from desired air fuel ratio. The integral windup effect suffered by PI based controllers has been removed here algorithmically by addition of a stable pole. This simple recursive structure, without any complex scheduling tables and transient fuel compensation, can also produce very fast recovery to the desired air fuel ratio. Comparative results with another widely used complex scheduling PI - based engine controller will be presented to show this significant finding. Finally we have not observed in literature a complete overall detailed explanation of this algorithm, addressing vital issues such as stability, sampling rate, tuning strategy or most importantly how algorithmic based PI can be implemented in a microprocessor environment. This paper will also address all these issues clearly and concisely to the extent that a formidable simple closed loop controller can be designed quickly. The presented algorithm is also applicable to UEGO based closed loop control.