The SOGI-FLL (Second-Order Generalized Integrator–Frequency-Locked Loop) is a well-known and simple adaptive filter that allows for estimating the parameters of grid voltage with a small computational burden. However, the SOGI-FLL has been shown to be especially sensitive to voltage sags and voltage swells, which deeply distort the estimated parameters, especially the frequency. This problem can be alleviated by simply using a saturation block at the Frequency-Locked Loop (FLL) output to limit the impact of distortion on the estimated frequency. Improving upon this straightforward approach, in this paper we propose the use of a finite state machine (FSM) for the definition of the different states of the SOGI-FLL frequency response during a voltage sag or swell fault. The FSM approach allows for applying different gains during the fault, enhancing the SOGI-FLL transient response. The performance of the FSM-based SOGI-FLL is evaluated by using simulation results, which show a better and faster response to these kinds of faults.