An original molecular imprinting photoelectrochemical (PEC) sensor for sarcosine detection based on stable lead-free inorganic halide double perovskite Cs2AgBiBr6 is proposed. Cs2AgBiBr6 as a lead-free halide perovskite material possesses severalpositive optoelectronic properties for PEC analysis, such as long-lived component to the charge-carrier lifetime, and strong absorption of visible light. At the same time, two-dimensional materials also offer excellent electronic and mechanical properties; thus, Bi2O2S was used and combined with Cs2AgBiBr6 to provide a stable and large photocurrent, which also benefits from the stability of perovskite Cs2AgBiBr6. Based on this novel PEC assay, the detection range for sarcosine was between 0.005 and 5000ng/mL with a low detection limit of 0.002ng/mL. This work also improved the adhibition of metal halide perovskite in analytical chemistry field, providing a novel way for other small molecule detection.