Microgrids are distribution networks consisting of distributed energy sources such as photovoltaic and wind turbines, that have traditionally been one of the most popular sources of energy. Furthermore, microgrids consist of energy storage systems and loads (e.g., industrial and residential) that may operate in grid-connected mode or islanded mode. While microgrids are an efficient source in terms of inexpensive, clean and renewable energy for distributed renewable energy sources that are connected to the existing grid, these renewable energy sources also cause many difficulties to the microgrid due to their characteristics. These difficulties mainly include voltage collapses, voltage and frequency fluctuations and phase difference faults in both islanded mode and in the grid-connected mode operations. Stability of the microgrid structure is necessary for providing transient stability using intelligent optimization methods to eliminate the abovementioned difficulties that affect power quality. This paper presents optimization and control techniques that can be used to provide transient stability in the islanded or grid-connected mode operations of a microgrid comprising renewable energy sources. The results obtained from these techniques were compared, analyzing studies in the literature and finding the advantages and disadvantages of the various methods presented. Thus, a comprehensive review of research on microgrid stability is presented to identify and guide future studies.