With exceptional electrical and mechanical properties and at the same time air-stability, layered MoSi2N4 has recently draw great attention. However, band structure engineering via strain and electric field, which is vital for practical applications, has not yet been explored. In this work, we show that the biaxial strain and external electric field are effective ways for the band gap engineering of bilayer MoSi$_2$N$_4$ and WSi$_2$N$_4$. It is found that strain can lead to indirect band gap to direct band gap transition. On the other hand, electric field can result in semiconductor to metal transition. Our study provides insights into the band structure engineering of bilayer MoSi$_2$N$_4$ and WSi$_2$N$_4$ and would pave the way for its future nanoelectronics and optoelectronics applications.