This paper presents an efficient home energy management system (HEMS) by optimal utilizing battery energy storage system (BESS) and photovoltaic (PV) systems. In the proposed HEMS, charging-discharging regime, capacity, and power of BESS are considered as design variables and optimally determined. Three operating conditions are considered for the home including: (i) home can receive energy from the network during off-peak low-cost hours, (ii) home can send energy to the main grid during on-peak high-costhours for making the profit, and (iii) home can work on net-zero energy (NZE) model or standalone mode. The BESS is utilized to store energy during off-peak low-cost hours and discharge energy during on-peak high-cost hours. The proposed planning for determining the optimal operation strategy and sizing of BESS is expressed as a stochastic mixed integer nonlinear programming (MINLP). As well, output power produced by photovoltaic (PV) system is regarded as uncertain parameter and modeled by probability distribution function (PDF). Monte-Carlo Simulation (MCS) is applied to cope with uncertainties. The proposed stochastic MINLP is solved by Meta-heuristic optimization techniques. Simulation results demonstrate that the proposed HEMS can significantly reduce annual electricity bill. As well, NZE model can also be achieved by installing BESS and PV system at the same time.