The problem of stochastic adaptive air-fuel ratio control by the dynamic model of biogas-fuelled engines is investigated in this paper. An adaptive law is employed to estimate the theoretical air-fuel ratio, which is undetermined due to the uncertainty of the methane concentration in the biogas. A stochastic adaptive air-fuel ratio controller in consideration of the stochasticity of the residual gas is designed based on the adaptive law, and the closed-loop system is proven to be mean-square stable. The proposed stochastic adaptive air-fuel ratio controller is validated through a numerical simulation when the theoretical air-fuel ratio is unknown constants and jump signals.