The present work focuses on the photocatalytic degradation of methylene blue (MB) on erbium ion (Er3+) doped TiO2under visible light. Pure TiO2nanoparticles and erbium (Er3+) doped TiO2nanocomposite (Er3+/TiO2) NCs were synthesized using the sol–gel method. The synthesized (Er3+/TiO2) NCs were characterized using Fourier transform infrared spectroscopy (FTIR), high resolution scanning electron microscopy (HR-SEM), elementary dispersive X-ray (EDX), X-ray diffraction (XRD), and X-ray photoelectron spectra (XPS), specific surface area (BET), zeta potential, and particle size. Different parameters were used to study their efficiency for the photoreactor (PR) and the synthesized catalyst. These parameters include pH of the feed solution, the rate of flow, the presence of an oxidizing agent (aeration pump), different ratios of nanoparticles, the amount of catalyst, and the concentrations of pollutants. An example of an organic contaminant was the dye methylene blue (MB). The result achieved using the synthesized nanoparticles (I) under ultraviolet light pure TiO2was found to have degraded by 85%. For (Er3+/TiO2) NCs under visible light, dye removal increased with pH to a maximum of 77% degradation at pH 5. Furthermore, photocatalytic efficiency improves to 80% at 40 rpm (3 l/h) low motor speed. The degradation efficiency decreased to 70% when the MB concentration was increased from 5 to 30 mg/L. When oxygen content was increased using an air pump, and deterioration reached 85% under visible light, it improved performance.