This brief investigates the cycle-to-cycle transient behavior of the residual gas fraction (RGF) in terms of systems theory and proposes a multivalued logic-based optimal control strategy for the attenuation of RGF fluctuation. First, an incylinder pressure-based method for measuring RGF is provided, and the stochastic properties of the RGF are examined based on statistical data obtained by conducting experiments on a full-scale internal combustion engine test bench. Based on the observation of the experiment, a stochastic logical transient model is proposed to represent the cycle-to-cycle transient behavior of the RGF. Then, an optimal feedback control law, which targets the rejection of the RGF fluctuation, is derived using the policy iteration algorithm. Finally, the experimental result is demonstrated to show the effectiveness of the proposed optimal control law.