 After 649 , the Tang Dynasty continued their war against the Western Turks under the reign of Emperor Gaozong , Taizong 's successor . Gaozong conducted a campaign led by general Su Dingfang against the Western Turk qaghan , Ashina Helu in 657 . The qaghan surrendered , the Western Turks were defeated , and the khaganate 's former territories were annexed by the Tang . The Tang retreated from beyond the Pamir Mountains in modern Tajikistan and Afghanistan after a Turkic revolt in 662 , and lost the Tarim Basin to local revolts and Tibetan incursions in 665 @-@ 670 . The Tang regained the Tarim Basin in 692 and again lost it to the Tibetans in the 790s , the Four Garrisons having already been cut off from the rest of the Tang empire by a Tibetan conquest of the Gansu Corridor . Although the Tibetan empire collapsed in the middle of the ninth century , the Tang Dynasty lacked the means to regain dominance in the Tarim Basin and itself ended in 907 with the abdication of Emperor Ai . 
