The middle Permian–Early Triassic terrestrial successions in the Junggar Basin record an important tectonic transformation stage characterized by the development of unconformities. These unconformities control billion-ton-scale hydrocarbon reservoirs in the northwestern Junggar Basin; however, their age, duration and underlying causes remain uncertain in the absence of an accurate Permian‒Triassic timescale. This study performed a comprehensive cyclostratigraphic analysis utilizing natural gamma ray data from 14 wells to determine the age and duration of the unconformities spanning from the middle Permian Lower Wuerhe (P2w) Formation to the lower Triassic Baikouquan (T1b) Formation while also revealing their potential origins. Our results suggest that astronomically forced climate changes were recorded in the western Junggar Basin during the Permian‒Triassic period. By applying astronomical tuning through sedimentation rates across each well, 14 time-domain series were generated. Using two previously reported maximum sedimentary ages from detrital zircon U–Pb dating, a 38.2-million-year long astronomical timescale was constructed, encompassing the period from the middle Permian Xiazijie Formation to the lower Triassic Baikouquan Formation. This analysis constrains the duration of unconformities between the P2w and T1b formations to ∼7–23 Myr. By integrating the duration, order, and implications of these unconformities with previously reported evidence, we conclude that the unconformity between the middle Permian and upper Permian was driven primarily by tectonic inversion resulting from intensified regional tectonic activity. In contrast, the unconformity between the upper Permian and Lower Triassic likely arose from uplift and erosion induced by compressive stresses associated with tectonic activity, which contributed to the formation of unconformities and stratigraphic discontinuities. This work provides a crucial reference for further studies aimed at integrating detailed sedimentological analyses with high-resolution geochronological data to further elucidate the timing and effects of these tectonic events on sedimentary facies and basin development.