Connecting different renewable energy sources (RESs) to the electrical grids is presently being urged to fulfil the enormous need for electric power and to decrease traditional sources’ ecological related issues, the so-called hybrid systems. Unfortunately, these hybrid systems suffer from the possible negative environmental impacts of the wind gusts in wind energy conversion systems (WECSs) that may degrade the overall system performance. Additionally, various severe faults may disconnect some RESs from the hybrid system, like three-phase faults. In this Project, the static synchronous compensator (STATCOM) is considered for both improving the performance of a hybrid system, contains WECS and photovoltaic (PVs) against wind gusts and maintaining the continuous operations of RESs during three-phase fault occur at the point of common coupling (PCC) between the RESs and the grid. The STATCOM is stimulated by two PI controllers regulating the reactive power flow between the STATCOM and the hybrid system at PCC and, consequently, regulating the voltage at PCC. A met heuristic optimizer optimally schedules these two PI controllers based on whale optimization algorithm (WOA). The impartial comparison between the WOA dynamic performance and the particle swarm optimization as another optimization algorithm verifies the efficiency of the WOA for the near-optimal gain scheduling of the PI controller gains.