Background In recent years, the problem of dye wastewater pollution has garnered significant attention. To solve this problem, photocatalysis technology has emerged as a promising approach, offering significant advantages and serving as a pivotal method for the degradation of wastewater containing dyes. Due to the unique electrochemical properties of rare earth metal elements and the ability of Ce doping to suppress and prohibit the recombination of the photogenerated electron-hole pairs, a simple sol-gel method was employed for the preparation of cerium-doped TiO2/C aerogel composites in this paper. Methods When the sol-gel reaction occurs, cerium nitrate is added and the amount of cerium nitrate is changed to prepare a set of samples. The samples are comprehensively characterized, and their photocatalytic activity is evaluated by photocatalytic degradation of methylene blue (MB). Results The results showed that the photocatalytic degradation rate of MB is the highest when the cerium nitrate in TiO2 was 0.3 mmol, due to its relatively large specific surface area and moderate TiO2 grains, as Ce content increases. The photocatalytic efficiency of MB remained relatively stable with increasing sample dosage. When the MB concentration was 20 mg/L, the photocatalytic degradation rate under visible light irradiation was higher than that under UV irradiation. Defects can be formed on the surface of TiO2 through Ce doping, where more surface groups are formed, thus improving the photocatalytic activity of the sample. Conclusion This study shows that cerium-doped TiO2/C has the potential to effectively solve the problem of dye wastewater pollution in nature.