This paper presents a solution for applying IoT technology to fire prevention from household gas leakages. The system consists of a smartphone application and an IoT circuit which can control equipment’s power supply, detect gas leakages, and monitor environment temperature. The smartphone application is built based on the Blynk tool, which is highly convenient and easy to install. The hardware consists of an ESP8266 microcontroller that collects data from two sensors, including DS18B20 temperature sensor and MQ-02 gas detector. The microcontroller can also alarm with a buzzer and cut off the power supply in the kitchen through an intermediate relay. The IoT circuit is integrated with an error compensation function, which is determined by the Levenberg-Marquardt least squares algorithm. In addition, the sensor data is also removed noised samples with abnormal amplitudes. Experimental results showed that the IoT circuit can detect gas leakages and release warning in a timely manner, without the appearance of "fake alarms" like common gas sensors on the market