Nanocomposites of nickel oxide (NiO NPs) with varying ratios on graphitic carbon nitride (g-C3N4) were synthesized using an ultrasonic method for use in photocatalytic degradation of methylene blue (MB) dye. Physicochemical techniques, including photoluminescence (PL), diffuse reflectance spectroscopy (DRS), transmission electron microscopy (TEM), Fourier transforms infrared spectroscopy (FTIR), and X-ray photoelectron spectroscopic analysis (XPS) were used to characterize the as-prepared nanocomposites. The impacts of medium pH, catalyst mass, and kinetic parameters on the photocatalytic degradation process were thoroughly explored and optimized. Incorporating 10 % NiO into g-C3N4 caused a 66 % drop in PL peak intensity, improved visible light harvesting in DRS measurements, and enhanced MB dye degradation performance from 33 % with pristine g-C3N4 to 91.6 % with NiO/g-C3N4 nanocomposite, at 90 min and pH 8.0. Additionally, TEM analysis revealed the successful synthesis of well-dispersed NiO NPs on g-C3N4. The investigation of scavengers' impact indicated that the Z-scheme photocatalytic mechanism aided in the effective separation of electron-hole pairs generated by visible light irradiation. Superoxide ion was proved to play a crucial role in the photocatalytic degradation of MB catalyzed by the synthesized NiO/g-C3N4 nanocomposite that exhibited remarkable stability in five consecutive cycles, losing only 5 % of its efficacy. This research contributes to the development of efficient and sustainable photocatalytic materials for environmental remediation applications.