ABSTRACT This study proposes using a Wind Energy Conversion System (WECS) to power a Unified Power Flow Controller (UPFC) Direct Current (DC) capacitor, maintaining appropriate voltage levels. This arrangement allows UPFC adjustment to improve Power Quality (PQ). The main issue rapid growth of nonlinear loads causes sudden variations in source voltage, resulting in a reduction in power quality within seconds. UPFC is used to address these concerns. This work uses the Harris Hawks Optimizer (HHO) to improve the performance of the UPFC. To begin, the aim function parameters are defined, including voltage, current, active power, and reactive power. Thus, these characteristics are used to generate control pulses for the series and shunt active power filters. HHO is used to find the best solution and predict the ideal UPFC control signal. Additionally, voltage instability and power dissipation decrease under different load conditions. Thus, system power supply quality improves. To evaluate the effectiveness of the proposed technique, two scenarios were identified: fault circumstances and engine speed changes. MATLAB/Simulink was used to implement the suggested strategy and compare it to established methodologies like Grey Wolf Optimization (GWO), Modified Particle Swarm Optimization (MPSO), and Whale Optimization Algorithm (WOA).