Severe events such as floods, earthquakes, and hurricanes cause disruption in the distribution networks and cause them to be islanded. In such circumstances, microgrids can be separated from the main grid with the help of their technical and communication infrastructure and transfer energy with each other to reduce their operation and outage costs. Therefore, energy management in a networked microgrid requires a modern operating framework to cause microgrids to supply each other with the energy they need. So, in this paper, a cooperative framework to improve the resilience response of microgrids has been proposed based on peer-to-peer energy transactions. In the developed model, since the microgrids are operated in a cooperative and networked manner, they sell energy to each other at the lowest possible cost. Utilizing the developed model, microgrids can improve their resilience response by peer-to-peer energy transactions in addition to reduce their operating costs, compared to the independent and non-cooperative models. To evaluate the efficiency of the proposed method, simulations have performed on a system with 14 microgrids, and the obtained results have compared and analysed. The results obtained have shown the efficiency of the proposed method in increasing resilience and reducing operating costs.