This study deals with control of pest population in agricultural ecosystem using sterile insect technique (SIT). A three-dimensional stage-structured model of the pest under the release of sterile male has been considered. This article also considers the effect of this technique under immigration of wild insects in the control area. Moreover, the deterministic model is extended to a stochastic one allowing random fluctuations around the positive interior equilibrium. The stochastic stability properties of the model are investigated, both analytically and numerically. The thresholds of sterile males that obtained from our study might be helpful to understand and implement the technique properly. Copyright © Taylor & Francis Group, LLC.