Clumped isotopic thermometry of carbonate minerals is a valid method for revealing the thermal history of sedimentary basins. This method has been successfully applied to basins with carbonate strata, whereas its application in basins composed of clastic strata is limited. This study focused on calcite cements in the upper Permian to Triassic terrestrial clastic strata in the Junggar Basin, northwestern China. Petrological, elemental geochemical and clumped isotopic analyses were conducted in combination with vitrinite reflectance analysis and forward thermal modelling. The studied strata contain multiple generations of calcite cement: early- and late-stage calcite. Relatively high δ13C values (−6.2‰ to −0.8‰), high δ18O values (−15.9‰ to −11.3‰) and low clumped isotopic temperatures (T(∆47): 31°C–43°C) suggest that the Permian and Triassic early-stage calcite precipitated during the penecontemporaneous stage. Considering the high MnO contents (2.22%~14.05%), extremely low δ13C values (−60.5‰ to −38.4‰) and high T(∆47) values (95°C–132°C), the late-stage calcite in the Triassic rocks is explained as the product of the oxidation of hydrocarbons by high-valence Mn/Fe oxides during mesodiagenesis. The high δ13C values (−10.2‰ to −10.7‰) indicate that the late-stage calcite in the Permian rocks is the product of the decarboxylation of organic acids. Constrained by the T(∆47) values of the early- and late-stage calcite and forward kinetic modelling, the maximum temperature of the upper Permian is confined to 150°C during the Late Jurassic. The thermal gradient of the study area exhibited an overall decreasing trend from 40°C·km−1 in the late Permian to 22°C·km−1 in the Cenozoic. The results are 2°C–4°C per km higher than those of previous works based on vitrinite reflectance and apatite fission track annealing. This research demonstrates that the combination of clumped isotope thermometry of multistage carbonate cements and kinetic modelling can quantitatively reveal a basin's thermal history.