Interconnecting two or more microgrids can help improve power system performance under changing operational circumstances by providing mutual and bidirectional power assistance. This study proposes two interconnected AC microgrids based on three renewable energy sources (wind, solar, and biogas). The wind turbine powers a permanent magnet synchronous generator. A solar photovoltaic system with an appropriate inverter has been installed. In the biogas generator, a biogas engine is connected to a synchronous generator. M1 and M2, two interconnected AC microgrids, are investigated in this study. M2 is connected to a hydro turbine, which provides constant power. The distribution power loss, frequency, and voltage of interconnected AC microgrids are modeled as a multi-objective function (OF). Minimizing this OF will result in optimal power flow and frequency enhancement in interconnected AC microgrids. This research is different from the rest of the research works that talk about the virtual inertia control (VIC) method, as it not only improves frequency using an optimal controller but also achieves optimal power flow in microgrids. In this paper, the following five controllers have been studied: proportional integral controller (PI), fractional-order PI controller (FOPI), fuzzy PI controller (FPI), fuzzy fractional-order PI controller (FFOPI), and VIC based on FFOPI controller. The five controllers are tuned using particle swarm optimization (PSO) to minimize the (OF). The main contribution of this paper is the comprehensive study of the performance of interconnected AC microgrids under step load disturbances, the eventual grid following/forming contingencies, and the virtual inertia control of renewable energy resources used in the structure of the microgrids, and simulation results are recorded using the MATLAB™ platform. The voltages and frequencies of both microgrids settle with zero steady-state error following a disturbance within 0.5 s with less overshoots/undershoots (3.7e-5/-0.12e-3) using VIC. Moreover, the total power losses of two interconnected microgrids must be considered for the different controllers to identify which one provides the best optimal power flow.