Light assistance and the construction of heterojunctions between two semiconductors with matching band structures are effective strategies for obtaining efficient gas sensors. Recently, Z-scheme heterojunctions have shown marked potential in promoting the separation and transfer of photogenerated carriers as well as possessing strong redox capability. In this study, two types of nanocomposites of WO 3 /CeO 2 and CeO 2 /WO 3 with Z-scheme heterojunctions were designed and prepared with WO 3 and CeO 2 as host materials, respectively. In the case of the WO 3 /CeO 2 nanocomposite, the CeO 2 nanoparticles are evenly distributed and attached to the WO 3 host. Conversely, in the CeO 2 /WO 3 nanocomposite, WO 3 is completely covered by the CeO 2 nanoparticles, forming a core−shell structure. The construction of Z-scheme heterojunctions effectively suppresses the recombination of photogenerated carriers, generates more active sites, and enhances redox capability. Resultantly, under UV light assistance, the sensors based on heterojunctions of WO 3 /CeO 2 and CeO 2 /WO 3 exhibit a selective response toward the oxidizing gas of NO 2 and the reducing gas of acetone, respectively, at room temperature. The WO 3 /CeO 2 sensor exhibits a response of 6.82 toward 100 ppb NO 2 , while the CeO 2 /WO 3 sensor exhibits a response of 6.45 toward 10 ppm acetone at room temperature (RT) under UV irradiation. The dynamic response/recovery characteristics of both heterojunction sensors were improved by UV irradiation, with an obvious shortening of the response/recovery time compared to the case in the dark. The experimental results demonstrate that the two sensors are capable of detecting NO 2 and acetone gases at RT, respectively. This work expands the application of Z-scheme heterojunctions in gas sensing and provides a strategy based on the design of special Z-scheme heterojunctions for developing high-performance gas sensors toward selective detection of oxidizing or reducing gas.