Increasing energy demand worldwide has resulted in more penetration of renewable sources for developing non-polluted electric energy despite their prices are not economically competitive to traditional generation systems due to intermittent nature of renewable resources. Energy storage systems are used to counteract the intermittent nature of renewable sources. Therefore, the optimal sizing and design of stand-alone renewable generating systems is a significant concern to get a more cost-effective system. This paper focuses on achieving the optimum design and size of a microgrid to meet the load requirements and reducing the total cost including capital, investment, operational and maintenance costs. For this aim, the sizing problem is formulated to be solved using three well-known metaheuristic algorithms, namely, Particle Swarm Optimization (PSO), Grey Wolf Optimization (GWO) and Cuckoo Search Optimization (CSO). The employed microgrid comprises hybrid renewable energy sources of PV/Wind systems integrated with a hybrid energy storage system of Battery and FC/Electrolyzer set for supplying AC loads located in Zafarana, Egypt. On the basis of real meteorological data of the studied location, the produced energies from the renewable sources are estimated using MATLAB developed algorithms. The simulation results showed that the optimized design using CSO can robustly and efficiently yield the optimal design of a microgrid.