In this paper, we theoretically investigate a scheme for both 1D and 2D electromagnetically induced gratings (EIGs) in M-type atomic systems in which two ground states are coupled by a microwave field. It is observed that the presence of a microwave field enhances the probe diffraction efficiency to higher orders, thus leading to the construction of phase gratings in 1D and 2D cases. The study shows that changing the system parameters numerically, such as the strength of the applied microwave field, standing wave field, and the length of the atomic medium, leads to modulation of diffraction efficiency into higher orders. The application of microwave fields is a more convenient parameter for attaining increased first-order diffraction. We believe that the proposed system with a microwave field can be used for designing novel microwave sensing devices for optical networking and communication.