In recent modern power systems, the number of renewable energy systems (RESs) and nonlinear loads have become more prevalent. When these systems are connected to the electricity grid, they may face new difficulties and issues such as harmonics and non-standard voltage. The proposed study suggests the application of a whale optimization algorithm (WOA) based on a fractional-order proportional-integral controller (FOPIC) for unified power quality conditioner (UPQC) and STATCOM tools. These operate best with the help of their improved control system, to increase the system’s reliability and fast dynamic response, and to decrease the total harmonic distortion (THD) for enhancing the power quality (PQ). In this article, three different configurations are studied and assessed, namely: (C1) WOA-based FOPIC for UPQC, (C2) WOA-based FOPIC for STATCOM, and (C3) system without FACTS, i.e., base case, to mitigate the mentioned drawbacks. C3 is also considered as a base case to highlight the main benefits of C1 and C2 in improving the PQ by reducing the %THD of the voltage and current system and improving the systems’ voltage waveforms. With C2, voltage fluctuation is decreased by 98%, but it nearly disappears in C1 during normal conditions. Additionally, during the fault period, voltage distortion is reduced by 95% and 100% with C2 and C1, respectively. Furthermore, when comparing C1 to C2 and C3 under regular conditions, the percentage reduction in THD is remarkable. In addition, C1 eliminates the need for voltage sag, and harmonic and current harmonic detectors, and it helps to streamline the control approach and boost control precision. The modeling and simulation of the prepared system are performed by MATLAB/Simulink. Finally, it can be concluded that the acquired results are very interesting and helpful in the recovery to the steady state of wind systems and nonlinear loads, thereby increasing their grid connection capabilities.