A multispecies one-dimensional biofilm model considering nitric oxide (NO) and nitrous oxide (N2O) productions for membrane aerated biofilm reactor (MABR) that remove nitrogen autotrophically through aerobic ammonia oxidation followed by Anammox is used to study the role of Anammox activity on the total nitrogen (TN) removal and the productions of NO and N2O. The model is applied to evaluate how periodic aeration as a control parameter reduces NO and N2O production but maintains high TN removal in MABR. The simulation results show over 3.5% of the removed TN could be attributed to NO and N2O production in MABR under the operational conditions optimal for TN removal (72%). An analysis of factors governing the Anammox activity in MABR shows that enhancing Anammox activity not only helps to achieve a high level of nitrogen removal but also reduces NO and N2O productions. Comparison of aeration strategies (periodic aeration vs. continuous aeration) reveals that periodic aeration can reduce NO and N2O production while maintaining a high level of nitrogen removal through promoting Anammox growth. Application of periodic aerations with different cycle frequencies to the MABR indicates that an increase in the cycle frequency of the periodic aeration can further maximize TN removal and minimize the NO and N2O production in membrane aerated biofilm. The information of this paper will be useful for understanding the indirect role of Anammox on NO and N2O productions and for optimizing the design and operation of MABR systems.