Flexible AC Transmission Systems (FACTS) play an important role in minimizing power losses and voltage deviations while increasing the real power transfer capacity of transmission lines. The extent to which these devices can provide benefits to the transmission network depend on their optimal location and sizing. However, finding appropriate locations and sizes of these devices in an electrical network is difficult since it is a nonlinear problem. This paper proposes a technique for the optimal placement and sizing of FACTS, namely the Thyristor-Controlled Series Compensators (TCSCs), Shunt VARs Compensators (SVCs), and Unified Power Flows Controllers (UPFCs). To find the optimal locations of these devices in a network, weak buses and lines are determined by constructing PV curves of load buses, and through the line stability index. Then, the whale optimization algorithm (WOA) is employed not only to find an ideal ratings for these devices but also the optimal coordination of SVC, TCSC, and UPFC with the reactive power sources already present in the network (tap settings of transformers and reactive power from generators). The objective here is the minimization of the operating cost of the system that consists of active power losses and FACTS devices cost. The proposed method is applied to the IEEE 14 and 30 bus systems. The presented technique is also compared with Genetic Algorithm (GA) and Particle Swarm Optimization (PSO). The findings showed that total system operating costs and transmission line losses were considerably reduced by WOA as compared to existing metaheuristic optimization techniques.