Air quality issues are critical to daily life and public health. However, air quality data are characterized by complexity and nonlinearity due to multiple factors. Coupled with the exponentially growing data volume, this provides both opportunities and challenges for utilizing deep learning techniques to reveal complex relationships in massive knowledge from multiple sources for correct air quality prediction. This paper proposes a prediction hybrid framework for air quality integrated with W-BiLSTM(PSO)-GRU and XGBoost methods. Exploiting the potential of wavelet decomposition and PSO parameter optimization, the prediction accuracy, stability and robustness was improved. The results indicate that the R2 values of PM2.5, PM10, SO2, CO, NO2, and O3 predictions exceeded 0.94, and the MAE and RMSE values were lower than 0.02 and 0.03, respectively. By integrating the state-of-the-art XGBoost algorithm, meteorological data from neighboring monitoring stations were taken into account to predict air quality trends, resulting in a wider range of forecasts. This strategic merger not only enhanced the prediction accuracy, but also effectively solved the problem of sudden interruption of monitoring. Rigorous analysis and careful experiments showed that the proposed method is effective and has high application value in air quality prediction, building a solid framework for informed decision-making and sustainable development policy formulation.