First-principles calculations were carried out to investigate the stability of two dimensional (2D) MB2 monolayers (TiB2-I, VB2-I, MnB2-I, TiB2-II, ScB2-II, NiB2-II) with an inverse sandwich configuration and their potential as efficient gas sensors to detect toxic gas molecules. We first identified five stable 2D MB2 configurations, based on stability evaluation covering thermodynamical, dynamical, and thermal aspects. To investigate the performance of these novel structures as gas sensors, the adsorption behavior of five toxic gas molecules (CO, NO, NO2, NH3, SO2) on MB2 has been explored, and the charge transfer and magnetic changes of these adsorption systems were analyzed. It is found that five gases are all chemisorbed on 2D MB2. Particularly, when CO is adsorbed on TiB2-II, the magnetism of the system undergoes a significant change from non-magnetism to antiferromagnetism, showing selectivity for CO. Furthermore, the current−voltage characteristics obtained from simulations confirm gas sensing performance. The TiB2-II is expected to be a candidate material for CO gas sensor with short recovery time (7.50 ×10−10 s). Our theoretical study provides new ideas for designing gas sensor nanomaterials with magnetism alteration as the indicator featuring easy measurement and fast response.