Nanomaterials doped with rare earth ions have attracted increasing interest in the renewable energy harvesting field. Erbium-doped ZnO nanoparticles were prepared by the solution polymerization method. The hexagonal wurtzite structure of ZnO was preserved, according to X-ray diffraction (XRD) studies, and the average crystallite size is less than 20 nm. The UV–Vis spectroscopy revealed that the optical band gap was 3.1 eV, with peaks associated with erbium-specific electronic transitions appearing when the doping concentration was raised (Er). Anthocyanin and curcumin dyes were employed to build dye-sensitized solar cells devices (DSSCs) employing nanoparticles as photoanodes. When compared to undoped ZnO, Er-doped ZnO at 1.25 at. percent improves power conversion efficiency (PCE) by 200% for anthocyanin dye and 10% for curcumin dye.