Developing room-temperature formaldehyde gas sensors with superior response-ability is crucial for many applications including the detection of indoor air pollutants. Herein, we synthesized a series of Ni-doped ZnO (Ni-ZnO) hierarchical porous structures decorated with NiS (NiS/Ni-ZnO) composite materials by the simple hydrothermal method, and the room-temperature (25 ± 1 ℃) UV light-activated photoelectronic formaldehyde sensors based on the ZnO, Ni-ZnO and NiS/Ni-ZnO composites were presented and compared. The response value of 0.2% NiS/0.4% Ni-ZnO material reached 330% toward 10 ppm formaldehyde gas, which was nearly 2.5 times higher than that of pure ZnO, and the faster response/recovery time (39.4 s/40.7 s) was obtained using UV light at room temperature. XPS, SPV, TPV spectrum analysis, and density functional theory (DFT) calculation showed that 0.2% NiS/0.4% Ni-ZnO sensor's excellent sensing performance was due to the synergistic effect of Ni doping and NiS modification which improved the separation efficiency and accelerated the migration of charge carriers. Here, the relationship between the response time of photoelectric gas sensors and the behavior of photogenerated carriers is firstly discussed in detail, which provides new insight into the development of room-temperature photoelectric gas sensors with superior response-ability. • NiS/Ni-ZnO hierarchical porous structure has been fabricated using hydrothermal method. • NiS/Ni-ZnO sensor exhibits fast response and high responsivity to formaldehyde at room temperature. • Excellent gas sensing performance of NiS/Ni-ZnO sensor is explained from the dynamic behavior of photogenerated carriers. • The relationship between the response time of gas sensor and the behavior of carriers is firstly discussed in detail.