In smart grids, a hybrid renewable energy system that combines multiple renewable energy sources (RESs) with storage and backup systems can provide the most cost-effective and stable energy supply. However, one of the most pressing issues addressed by recent research is how best to design the components of hybrid renewable energy systems to meet all load requirements at the lowest possible cost and with the best level of reliability. Due to the difficulty of optimizing hybrid renewable energy systems, it is critical to find an efficient optimization method that provides a reliable solution. Therefore, in this study, power transmission between microgrids is optimized to minimize the cost for the overall system and for each microgrid. For this purpose, artificial bee colony (ABC) is used as an optimization algorithm that aims to minimize the cost and power transmission from outside the microgrid. The ABC algorithm outperforms other population-based algorithms, with the added advantage of requiring fewer control parameters. The ABC algorithm also features good resilience, fast convergence, and great versatility. In this study, several experiments were conducted to show the productivity of the proposed ABC-based approach. The simulation results show that the proposed method is an effective optimization approach because it can achieve the global optimum in a very simple and computationally efficient way.