Abstract The Permo-Carboniferous sandstones in the Gubei area, Bohai Bay Basin, are reservoirs for large accumulations of natural gas. The natural gas accumulations only occur in the sandstone beds thicker than 1.9 m. Moreover, the maximum porosity of every bed correlates positively with bed thickness up to 2.0 m and for thicker beds porosity is uniform. Porosity transitional zones developed at the top and bottom of each bed, with mean thicknesses of 1.25 m and 0.75 m, respectively. Porosity shows a positive correlation with the distance to the sandstone/mudstone contact in the zones. Interpretations based upon an extensive petrographic and geochemical database indicate that the sandstones experienced a mass fluid input from the adjacent mudstones during the early diagenesis. The infiltration resulted in extensive clay coats and pore-filling cements in sandstones, which were effective for inhibiting dissolution of grains during subsequent diagenesis process. The mass introduction only affected the marginal parts of the sandstones within 1.25 m of the top and 0.75 m of the bottom of every bed, causing thin sandstone beds with thickness of approximately 2 m to be tightly cemented totally. Thus the central parts of each (thicker) beds became preferential sites for the natural gas accumulation. The differential levels of cementation in thin and thick sandstone beds observed here has significant implications for exploration of similar interbedded sandstone and shale sequences elsewhere including shale gas targets.