Recent discoveries of oil and gas have principally been located in the central part of the Ordos Basin, which is a petroliferous basin with the largest discovered reserves and annual production of tight sandstone gas in China. For tight sandstone gas reservoirs in the transition zone of the basin margin, the process of natural gas accumulation has remained relatively vaguely understood, because of the transitional accumulation of geological conditions such as structure, sedimentation, and preservation. In this study, thin-section identification and scanning electron microscopic observations of the reservoir core, measurement of the physical properties of the reservoir, microscopic petrography research and measurement of the homogenization temperature of fluid inclusions, digital simulations, and laser Raman spectroscopy analysis were combined to analyze the process of natural gas accumulation of the Permian Lower Shihezi Formation in Duguijiahan block, Hangjinqi area, northern Ordos Basin. The results showed that the Lower Shihezi Formation reservoir in the Duguijiahan block began gas charging in the southern part as early as the Early Cretaceous (130–128 Ma), and then gradually charged in the northern part. Three stages were identified in the digital simulations of gas charging, i.e., the breakthrough, rapid, and fully saturated stages. The initial porosity of the Lower Shihezi Formation reservoir ranged between 28% and 40%. Later, because of strong compaction and interstitial filling during burial, the sandstone porosity decreased rapidly, and densification (porosity < 10%) occurred in the mid–late Jurassic. This late tectonic uplift caused a continuous reduction in ground temperature, and diagenesis had a weak effect on pore transformation. The present porosity of the Lower Shihezi Formation reservoir basically inherited its characteristics in the late Early Cretaceous. The current average porosity of the reservoir is 8.58%, and the average permeability is 0.88 mD, and it can thus be characterized as a tight reservoir. The gas accumulation process of the Lower Shihezi Formation has three stages: (1) the depositional stage (C–P), corresponding to the depositional stage of the source-reservoir-cap combination in gas reservoir; (2) the natural gas accumulation stage (T–K1), corresponding to the period of rapid source rock maturation and natural gas charging step-by-step; and (3) the gas reservoir adjustment stage (K2–present), corresponding to the period of uplift and natural gas charging in the early stage that gradually migrated and accumulated northward along the fracture zone. Finally, the gas accumulation model in the transition zone at the margin of basin was established.