Semiconductor doping can promote the photoelectrocatalytic application of semiconductor materials by constructing impurity energy levels and reducing the band gap. In this paper, we designed a preparation method for metal?doped semiconductor materials. The transition metal Co was combined with the anionic ligand of the metal?organic framework (MOF)MIL?125 through coordination. Then, the Co?doped TiO2 was obtained through pyrolysis, and its performance in photocatalysis was studied. The results showed that the co?doped TiO2 exhibits a high photocurrent density (9.87 μA/cm2), which is 3.8 times of the undoped TiO2. Meanwhile, the degradation reaction rate constant also significantly increases from 0.041 min?1 before doping to 0.063 min?1 after doping. The incorporation of Co species not only extends the visible?light absorption edge of TiO2 but also introduces well?defined impurity energy levels within its bandgap, thereby facilitating efficient separation and migration of photogenerated charge carriers while significantly suppressing electron?hole recombination.