AbstractWith the growth of the load in the electricity networks, sufficient investment in the generation and lines expansion should be made in order to provide the energy needed by consumers with the lowest possible investment and operation costs. This issue is especially important in distribution networks, which are faced with the uncertainties of renewable energy generation and the development of microgrids and related issues.In this article, the planning of generation and lines expansion has been modeled with the aim of minimizing the total costs of microgrids, based on the cooperative approach. For this purpose, a bi‐level model has been developed; on the upper level, microgrids make investment decisions with a cooperative approach, and a constrained stochastic formulation has been developed with considering operational uncertainties on the lower level. Also, in this article, in order to ensure the supply of critical loads in island conditions, the self‐sufficiency index is defined. Three case studies have been considered to ensure the effectiveness of the developed model. In case 1, each microgrid will be able to supply its load only by generating of its units and purchasing from the retail market. In case 2, the possibility of trading with other microgrids in a non‐cooperative approach will also be available to the microgrids operators, and in case 3, microgrids can exchange energy with other microgrids in a cooperative manner. The simulation results showed that due to the possibility of using nearby microgrid resources, the cost of microgrid load supply in case 2 was reduced by 4.84% compared to case 1. Also, this cost in case 3 was reduced by 5.23% and 0.38%, respectively, compared to cases 1 and 2, due to the use of a cooperative manner in microgrid load providing.