The textile industry is an important economic sector; however, its wastewater generates a great impact on the environment. A heterogeneous solar Fenton (HSF) process was evaluated for denim wastewater treatment. The catalyst was obtained through ultrasonic modification of recycled polyethylene terephthalate (PET) with Fe nanoparticles (PET/NPs- Fe3O4). The SFH process was optimized using surface response methodology with a face-centered central composite design considering the effects of the hydraulic retention time (10, 25, and 40 min), hydrogen peroxide dosage (500, 1000, and 1500 mg/L), and mass of the packed catalyst (4, 6 and 8 g) on the color, COD, and turbidity removal efficiencies. The operating conditions for maximum COD removal were H2O2 541.7 mg/L, HRT 33.9 min, and PET/NPs- Fe3O4 dose 7.9 g with solar radiation. The removal of 91.2% COD, 86.2% color, 90.4% turbidity, and 81.9% TOC was obtained at 14.2 kJ/L QUva. PET modification yielded 1.6 mg Fe/g PET, and the modification method does not allow Fe leaching. The effluent obtained from the SFH process complies with the maximum permissible limits in Mexican legislation in terms of COD, TOC, turbidity, and color and allows the reuse of PET.