Selection problem and difficulties caused by unobserved shocks and simultaneity problem which is created by the relationship between productivity and inputs demand, when firms determine the optimum level of input, could have a significant effect on estimation of independent variables. Existence of these two problems in decision making of firms causes that the estimators such as least squares have biased estimation for elements of production function. In this article, in addition to introduction of the three-step semi-parametric estimator of Olly and Pakes (1996) in order to control the biases of selection and simultaneity, we use this method to estimate tomato production function based on information of fourteen provinces of Iran in period of 1379-1386. Result of production function estimation with semi-parametric method (unlike traditional methods), showed that the physical capital, labor, water, seed, poison and fertilizer had positive relationship with amount of production, and among all of inputs, labor force, water, seed and poison were significant. Also results of models showed that estimated parameters of labor and capital were consistent with the implications of Olly and Pakes (1996) and showed that labor estimated parameter in traditional methods (unlike semi-parametric method), had an upward bias and the coefficient associated with capital was downward biased. Therefore, in estimation of production function and modeling of shocks, dynamics of productivity should be noticed in order to have unbiased result for estimation of factor shares. Also for processing tomato and increase in use of agricultural machinery, it is necessary to create tax incentives in order to reach the acceptable situation and modernizing tomato farms.