Static synchronous compensator (STATCOM) provides the means to improve quality and reliability of a power system as it has the functional capability to handle dynamic disturbances, such as transient stability and power oscillation damping as well as to providing voltage regulation. In this paper, a robust adaptive PI-based optimal fuzzy control strategy is proposed to control a STATCOM used in distribution systems. The proposed intelligent strategy is based on a combination of a new General Type-II Fuzzy Logic (GT2FL) with a simple heuristic algorithm named Teaching Learning Based Optimization (TLBO) Algorithm. The proposed framework optimally tunes parameters of a Proportional-Integral (PI) controller which, similar to most of other researchers regarding control of STATCOM, are in charge of controlling the device. The proposed controller guaranties robustness and stability against uncertainties caused by external disturbances or ever-changing nature of the power systems. The TLBO optimizes the parameters of the controller as well as the input and output membership functions. To validate the efficiency of the proposed controller, the obtained simulation results are compared with those of the two most recent researches applied in this field, namely, conventional Proportional Integral (PI) controller and Optimal Fuzzy PI (OFPI) controller. Results demonstrate the successfulness and effectiveness of the proposed online-TLBO General Type-2 Fuzzy PI (OGT2FPI) controller and its superiority over conventional approaches.