A wind turbine, battery energy storage system, and photo-voltaic system are the three main sources included in this work as hybrid renewable energy systems (HRESs). To alleviate power quality (PQ) issues, i.e., swell, sag, harmonics, interruption, and fluctuation, a unified power flow controller (UPFC) is utilized in this paper. The major goal of this research is to compensate the load demand, mitigate the PQ issues, and reduction of cost as well as power flow along with IEEE-14 bus system. In HRESs, the PQ issues are mitigated by utilizing a novel hybrid optimized technique called GWO-CS approach-based UPFC. By utilizing the hybrid optimized technique, the PID controller is employed to drive the pulse width modulation of this UPFC. Numerous PQ issues like fluctuations, interruptions, estimation of harmonics, sags, and swells are evaluated in this paper by validating the enactment of the presented methodology, and also this technique is simulated in MATLAB/Simulink to analyze the outcomes. Moreover, to validate the efficacy of the proposed method, the presented technique is compared with the conventional approaches, i.e., GWO, PSO, and hybrid PSO-based GWO.