The intensive development of the petrochemical industry globally reflects the necessity of an efficient approach for oily sludge and wastewater. Hence, for the first time, the current study utilized magnetic waxy diesel sludge (MWOPS) to synthesize activated carbon coated with TiO2 particles for the removal of total petroleum hydrocarbons (TPH) and COD from oily petroleum wastewater (OPW). The photocatalyst was characterized using CHNOS, elemental analysis was performed using X-ray fluorescence spectroscopy (XRF), field emission scanning electron microscope (FESEM), high-resolution transmission electron microscope (HR-TEM), X-ray diffraction analysis (XRD), Fourier transform infrared spectrometer (FTIR), Raman, energy dispersive X-ray spectroscopy (EDX), X-ray photoelectron spectroscopy (XPS), MAP thermo-gravimetric analysis/ differential thermo-gravimetric (TGA–DTG), Brunauer–Emmett–Teller (BET), diffuse reflectance spectroscopy (DRS), and vibrating sample magnetometer (VSM). The optimization of synthesized highly porous AC/Fe3O4/TiO2 photocatalyst was conducted considering the impacts of pH, temperature, photocatalyst dosage, and UVA6W exposure time. The results demonstrated the high capacity of the MWOPS with inherent magnetic potential and desired carbon content for the removal of 91% and 93% of TPH and COD, respectively. The optimum conditions for the OPW treatment were obtained at pH 6.5, photocatalyst dosage of 250 mg, temperature of 35 °C, and UVA6W exposure time of 67.5 min. Moreover, the isotherm/kinetic modeling illustrated simultaneous physisorption and chemisorption on heterogeneous and multilayer surfaces. Notably, the adsorption efficiency of the AC/Fe3O4/TiO2 decreased by 4% after five adsorption/desorption cycles. Accordingly, the application of a well-designed pioneering photocatalyst from the MWOPS provides a cost-effective approach for industry manufacturers for oily wastewater treatment.