The Mesozoic–Cenozoic clastic rocks in the Tabei Uplift form one of the most hydrocarbon-rich zones in the Tarim Basin of China. Understanding how diagenesis has affected the petrophysical properties of the sandstone is crucial for developing regional exploration strategies. Although most studies have investigated the physical conditions during sedimentation and chemical processes during diagenesis, the hydrochemical environment during sedimentation and subsequent diagenesis has received little attention. This study employed petrographic observations, paleo-geothermal reconstructions, and paleoenvironmental analysis to constrain the regional climatic conditions, hydrochemical environment of deposition, and diagenetic features of clastic rocks in the Tabei Uplift. The sandstone at depths of 3500–6000 m is located mainly in the A phase of the middle diagenetic stage, and exhibits three types of diagenesis. Triassic–Jurassic sandstones are dominated by silica, kaolinite, and chlorite cements, Cretaceous sandstones by mainly carbonate cements, and Paleogene sandstones by carbonate and evaporite cements. These diagenetic stages correspond to paleoclimatic changes during the earliest Late Jurassic and the maximum marine transgressions of the Proto-Tethys during the Paleogene, thereby highlighting the influence of climatic change and transgressions on the water conditions during deposition and the type of diagenesis.