Sulfur dioxide (SO2) is a colorless toxic gas, and accurate monitoring of its concentration is important for safety. However, accuracy is often interfered by humidity. To address the issues, in this work, a self-calibrating SO2 sensor based on CsPbBr3/SnO2 was prepared, the sensor exhibited an excellent response to parts per billion (ppb) levels of SO2 at room temperature, which is rarely achieved by other SO2 sensors. The response sensitivity of the sensor to 600 ppb SO2 reached up to 0.53 with response/recovery times of 17/285 s. In addition, the CsPbBr3/SnO2-based SO2 gas sensor showed a low detection limit, good reproducibility, and high selectivity. Moreover, theoretical calculations show that the gas recognition mechanism is attributed to the significant changes in the band structure and density of states of the heterojunction materials CsPbBr3/SnO2 after gas adsorption, thereby altering the charge carrier transport behavior and electrical properties. A self-calibrating algorithm MobileNetV2 was employed to eliminate humidity interference and effectively identify low-concentration SO2 in humid environments, and the recognition accuracy rate is 0.85. This work demonstrates the production of a high-performance SO2 gas sensor, and provides an effective method to eliminate the interference of humidity, making it significant in environmental monitoring and air quality control.