Modern diesel engines equip the exhaust gas recirculation (EGR) system because it can suppress NOx emissions effectively. However, since a large amount of exhaust gas might cause the degradation of drivability, the control strategy of EGR system is crucial. The conventional control structure of the EGR system uses the mass air flow (MAF) as a control indicator, and its set-point is determined from the well-calibrated look-up table (LUT). However, this control structure cannot guarantee the optimal engine performance during acceleration operating conditions because the MAF set-point is calibrated at steady operating conditions. In order to optimize the engine performance with regard to NOx emission and drivability, an optimization algorithm in a function of the intake oxygen fraction (IOF) is proposed because the IOF directly affects the combustion and engine emissions. Using the NOx and drivability models, the cost function for the performance optimization is designed and the optimal value of the IOF is determined. Then, the MAF set-point is adjusted to trace the optimal IOF under engine acceleration conditions. The proposed algorithm is validated through scheduled engine speeds and loads to simulate the extra-urban driving cycle of the European driving cycle. As validation results, the MAF is controlled to trace the optimal IOF from the optimization method. Consequently, the NOx emission is substantially reduced during acceleration operating conditions without the degradation of drivability.