SO2F2 is a typical fault product of SF6 electrical insulation equipment. Detecting SO2F2 can indicate whether the equipment is faulty. SO2F2 is a hazardous gas that can cause harm to the human body. This study reports on the development of the SO2F2 sensor using TiO2-NiS for the first time, and the investigation of its gas sensitivity to SO2F2 in SF6 background and air. The effective construction of the TiO2-NiS heterojunction was characterized via the XRD, SEM, and TEM. The TiO2-NiS heterojunction sensor for SO2F2 has a working temperature of 150°C in both SF6 and air environments with the response and recovery time of 6 s/2 s to 5 ppm SO2F2 in the air and 5 s/6 s in the SF6 environments, respectively. The sensor has a strong linear fit and a detection limit of 100 ppb. The long-term stability, selectivity, resistance to moisture, and responsiveness/recovery are features of this sensor. Furthermore, it was demonstrated that SO2F2 adsorption performance on the TiO2-NiS heterojunction outperformed that of TiO2 and NiS based on first principles, and density of states and differential charge density provided a more detailed description of the interaction between SO2F2 gas and the TiO2-NiS heterojunction. The oxygen competitive adsorption of SO2F2 and lattice oxygen molecules on the surface of TiO2-NiS heterojunction, as well as the interaction between adsorbed F2− on the TiO2-NiS heterojunction surface and SO2F2, may be used to characterise the sensing mechanism in the SF6. At the same time, the prepared SO2F2 sensor can effectively measure the concentration of SO2F2 through hardware, and give early warning when the concentration exceeds the safe value.