Porosity is one of the most important properties for evaluating hydrocarbon reservoirs. There is a strong nonlinearity between seismic data and rock physical properties. Machine learning methods possess the powerful ability to capture complex nonlinear relationships between these two parameters, holding significant potential for porosity prediction in tight sandstone reservoirs. In this study, we propose a seismic facies-controlled porosity prediction method based on the extreme gradient boosting algorithm. Through seismic meme inversion method,we obtain high-resolution P-impedance data. In the inversion process, lateral variations of seismic waveforms were utilized instead of the variogram function. We create labels for model training using porosity curves and borehole side P-impedance data, applying them to the extreme gradient boosting regressor. To demonstrate its feasibility, we apply the model to a real 3D case from an oil field in the Songliao Basin. Our application results demonstrate that this method can provide porosity predictions for tight sandstone reservoirs, maintaining consistency with seismic waveforms and adhering to seismic facies control patterns. The method uses only acoustic travel time, density, gamma rays, and spontaneous potential well-log data and post-stack 3D seismic data as inputs, allowing for quick porosity predictions in the field. Compared to the seismic facies-controlled inversion combined with support vector machine and multi-Layer perceptron methods, the method proposed in this study provides more reliable porosity predictions, offering insights and references for the exploration and development of tight sandstone reservoirs.