High levels of antibiotic accumulation and the difficulty of degradation can have serious consequences for the environment and, therefore, require urgent attention. To solve this problem, a synergistic Er and Cd ion-codoped Bi4O5Br2 photocatalyst was proposed. The degradation rate of sulfamethoxazole (SMX) by Er/Cd-Bi4O5Br2 was eight times higher than that of pure Bi4O5Br2, exceeding that of single Er-doped or Cd-doped Bi4O5Br2, which was attributed to the ability of Er/Cd-Bi4O5Br2 to generate a variety of free radicals. Experimental results and theoretical calculations suggested a possible mechanism for the improved photocatalytic degradation rate. The reduction of the band gap can facilitate the production of electron-hole pairs, which play a significant role in the production of reactive radicals. Furthermore, an optimal stabilized structure of the ErCd-Bi4O5Br2 dopant system was identified based on the formation energy formulas of different ligand configurations. These findings offer promising potential for the degradation of broad-spectrum antibiotics and provide valuable insights for the design and modification of photocatalytic materials.