Hybrid energy systems (HESs) are gaining prominence as a practical solution for powering remote and rural areas, overcoming limitations of conventional energy generation methods, and offering a blend of technical and economic benefits. This study focuses on optimizing the sizes of an autonomous microgrid/HES in the Kingdom of Saudi Arabia, incorporating solar photovoltaic energy, wind turbine generators, batteries, and a diesel generator. The innovative reinforcement learning neural network algorithm (RLNNA) is applied to minimize the annualized system cost (ASC) and enhance system reliability, utilizing hourly wind speed, solar irradiance, and load behavior data throughout the year. This study validates RLNNA against five other metaheuristic/soft-computing approaches, demonstrating RLNNA’s superior performance in achieving the lowest ASC at USD 1,219,744. This outperforms SDO and PSO, which yield an ASC of USD 1,222,098.2, and MRFO, resulting in an ASC of USD 1,222,098.4, while maintaining a loss of power supply probability (LPSP) of 0%. RLNNA exhibits faster convergence to the global solution than other algorithms, including PSO, MRFO, and SDO, while MRFO, PSO, and SDO show the ability to converge to the optimal global solution. This study concludes by emphasizing RLNNA’s effectiveness in optimizing HES sizing, contributing valuable insights for off-grid energy systems in remote regions.