The photocatalytic degradation of wastewater is the most promising environmental remediation. This study focused on chlorpyrifos as a model pollutant due to its widespread use as an organophosphate insecticide. Carbon and nitrogen co-doped titanium dioxide nanoparticles (C, N-TiO2 NPs) were synthesized using a sol-gel method, employing titanium isopropoxide, urea, and carboxymethylcellulose as titanium, nitrogen, and carbon precursors, respectively. The C, N-TiO2 NPs were characterized using X-ray diffraction (XRD), photoluminescence (PL) spectroscopy, UV-visible diffuse reflectance spectroscopy, and high-resolution transmission electron microscopy (HRTEM) for the optical, chemical and physical characteristics. Analytical results from XRD and HRTEM revealed anatase-phase structures with a reduced bandgap energy of 2.95 eV. Compared to pure anatase TiO2, the synthesized C, N-TiO2 NPs exhibited slower electron-hole pair recombination, according to PL analysis. Under solar light irradiation, an optimal catalyst dosage of 0.12 g achieved 90 % chlorpyrifos breakdown at 8 ppm concentration and 62.1 % mineralization degree, with superoxide radicals (center dot O2- ) as the dominant ROS. The photocatalyst exhibited remarkable reusability, achieving 79.5 % removal of chlorpyrifos over five cycles during photodegradation processes. Thus, this study creates TiO2 NPs doped with carbon and nitrogen as an effective photocatalyst for wastewater treatment.