Environmentally-friendly renewable energy sources have been developed and commercialized to mitigate impact of climate change on the environment. Solar photovoltaic (PV) systems have gained much attention as a power generation source for various uses, including the primary utility grid power supply. There has been a significant increase in both on-grid and off-grid solar PV installations. Because of the highly unpredictable nature of solar power generation, it is crucial to forecast solar power accurately for renewable resources-based power systems. In this research, a swarm-based ensemble forecasting strategy has been proposed to predict solar PV power by combining three strategies, i.e., particle swarm optimization-based gated recurrent unit (PSO-GRU), PSO-based long short-term memory (PSO-LSTM), and PSO-based bidirectional long short-term memory (PSO-BiLSTM). Bayesian model averaging (BMA) combines the output of the proposed strategy by aggregating the output of each swarm-based approach. The performance of the suggested approach is evaluated and verified using historical data of solar PV power which is acquired from Griffith University, Australia. Python 3.11 is used to validate the performance of the proposed ensemble strategy and compared it with several competing strategies. The proposed ensemble strategy outperforms other comparative strategies in terms of RMSE, NRMSE, and MAE.