This paper presents an optimal control method for a compact reduced switch count AC/AC converter in an AC microgrid. The AC/AC converter is adopted to interconnect dual three-phase renewable energy sources (RESs) and a three-phase permanent magnet synchronous motor (PMSM) to the grid to form an example of a mixed grid-feeding-drive system. For the adopted converter, a generalized pulse width modulation (PWM) scheme employing the third harmonic injection and a control method are proposed. Moreover, to achieve reduced dc link voltage ripple, good reference tracking and disturbance rejection, the gains of the controllers are optimized by minimizing a weighted sum of different objective functions. Each objective function represents a specific aspect to be minimized and the optimization problem is solved employing particle swarm optimization (PSO) method, while ensuring that the total harmonic distortion (THD) of the current at the points of common coupling (PCC) are less than 5%. For this mixed grid-feeding-drive system, simulation results under fast transient are provided to demonstrate the applicability of the adopted converter in the AC microgrid, the effectiveness of the proposed PWM, and the proposed optimal control method.