This paper focuses on the modeling, analysis, and design of grid-forming (GFM) inverter-based microgrids (MGs). It starts with the development of a mathematical model for three-phase voltage source inverters (VSI). The voltage and current controllers consist of two feedback loops: an outer feedback loop of the capacitance-voltage and an inner feedback loop of the output inductance current. The outer voltage loop is employed to enhance the controller’s response time. The inner current loop is used to provide active damping for the resonance created by the LCL filter. A two-layer control scheme is adopted for the GFM inverter control. The primary decentralized control uses droop control and virtual impedance loops to share active and reactive power. Simultaneously, the centralized secondary control addresses frequency and amplitude deviations induced by the droop control. Additionally, a synchronization loop is proposed for seamless reconnection of GFM inverters to the MG and to connect the GFM-controlled MG to the main grid. It has the advantage that the inverter operates in GFM mode even after the synchronization has occurred. The simulation results have shown that the voltage controller ensures a 0.005 s settling time and maintains the steady-state error at its minimum value of 0.1 V. Similarly, the current controller ensures a 0.006 s settling time with a 10−5 steady-state error. The system with the designed controller has a low total harmonic distortion (THD) of 1.46% and improved power quality of the output voltage. Furthermore, a quick restoration time is observed during load steps and tripping events, with a restoration time of 1 s with 10−10 steady-state error. Synchronization is achieved within 0.8 s for the incoming inverters and requires 3 s to synchronize the MG with the main grid, maintaining a steady-state error of 10−9.