Recently, researchers have shown an increased interest in using renewable-based distributed generations (DGs) in microgrids (MGs). Therefore, the economic operation of MGs plays a vital role in reducing total daily costs and greenhouse gas emissions in the modern power system. This study presents a day-ahead optimization management for a grid-tied MG supplied by small-scale renewable energy sources (RESs) like photovoltaic (PV) systems. The major aim of the suggested optimal energy management system is to minimize the cost of RERs and storage facilities in the MG for power generation while satisfying technical constraints. In addition, an improved mathematical model is suggested for the PV power generation using real data for four dissimilar days. To attain accurate results, uncertainties in the generations, load demand, and market price are probabilistically modeled. To handle the optimization problem, the θ-modified krill herd (θ-MKH) algorithm is used. The suggested algorithm for solving the optimization problem is investigated on numerical examples with different RESs and storages in the MG and compared with conventional approaches. The results attained illustrate that the recommended algorithm can utilize the cheapest sources while covering technical constraints.