Around the new year 756, while Gao and fellow general Feng Changqing were defending Tong Pass against forces of An Lushan, who had rebelled against Tang rule in 755, both Gao and Feng offended the powerful eunuch Bian Lingcheng (邊令誠). Bian then accused Feng of cowardice and Gao of corruption, and both were executed.
Although Gao Xianzhi was an ethnic minority, his loyalty and bravery, as well as his father's accomplishments, allowed him to be promoted to the position of general in the Tang army in his 20s, serving in Central Asia near Kashgar, in the Taklamakan Desert along with his father, under the Tang military command for Anxi Circuit (安西, headquartered in modern Aksu Prefecture, Xinjiang). He successively served under the military governors (jiedushi) Tian Renwan (田仁琬) and Gai Jiayun (蓋嘉運), but was not promoted by them. However, Gai's successor Fumeng Lingcha (夫蒙靈詧) was impressed by him, and so repeatedly recommended him for promotions. By the end of Emperor Xuanzong's Kaiyuan era (727-741), he was serving as Fumeng's deputy.
However, Fumeng was angry that Gao directly reported the news of the victory to Emperor Xuanzong without first reporting to him, cursing him with obscenities and threatening to kill him. The eunuch Bian Lingcheng, whom Emperor Xuanzong had sent to monitor Gao's forces, interceded on Gao's behalf and reported Fumeng's threats to Emperor Xuanzong. Emperor Xuanzong, in response, around the new year 748, summoned Fumeng back to the capital Chang'an and promoted Gao to take over his position. Despite this, Gao never lost his respect for Fumeng, although he arrested several of Fumeng's subordinates who attacked him -- fellow deputy military governor Cheng Qianli (程千里), and the army officers Bi Sichen (畢思琛) and Wang Tao (王滔), but then released him, stating that he was venting his anger, and that now that he had, he believed that they could still serve under him. He entrusted Feng Changqing as his assistant, often having Feng lead troops or, when he himself led troops in campaigns, had Feng be in charge of the headquarters. Li Siye also first distinguished himself as an army officer under Gao.
As a result of Gao's first campaign, Tang began to contend for influence with the Abbasid Caliphate and Tufan in the area of modern northern Pakistan and Afghanistan. About 72 local Indian and Sogdian kingdoms became Tang vassals, ending the Tufan dominion of the Pamir Mountains. While he served as the military governor of Anxi, placing such places as Tokmak, Kucha, and Kashmir, under the jurisdiction of his headquarters.
Meanwhile, though, a Shi prince had fled, and he reported to the various states around the region how Gao had turned on Shi and destroyed it. The states, in anger, aligned with the Abbasid Caliphate. When Gao heard this, he made a preemptory attack with 30,000 soldiers against Abbasid Caliphate, reaching Talas (in modern Khazakhstan) and meeting Abbasid forces there. The armies fought bitterly for five days, before Qarluq forces turned against Gao. Tang forces were crushed, with only several thousand surviving out of the 30,000, and that remnant was only saved due to the valiant efforts of Li Siye. Another subordinate of Gao who distinguished himself at the battle was Duan Xiushi, whom Gao recommended for promotion after the battle. The battle marked the end of Chinese advances to the west, and the heavy losses by Abbasid forces despite the victory appeared to end Abbasid designs in the east as well. Gao was then made a commanding general of the imperial guards. In 755, Gao was created the Duke of Miyun.
Meanwhile, Feng Changqing was sent to the eastern capital Luoyang to defend against An's attack on Luoyang, but once Feng got to Luoyang, he was given inadequate weapon supplies, and An's forces defeated his. Feng retreated to Shan, and suggested to Gao that Shan was not easily defendable and that they should retreat to Tong Pass, which was a much better defensive position. Gao agreed, and the two of them took up position at Tong Pass. When An's forces subsequently attacked Tong Pass, they could not capture it, and historians credited Gao with the improved defenses.
However, during the campaign, Gao had caused much offence against Bian, as Bian was making demands of him that he was not meeting. When Bian returned to Chang'an, he accused Feng of exaggerating An's strength, and accused Gao of improperly abandoning Shan as well as corruptly withholding food supplies and imperial rewards to soldiers for personal benefit. Emperor Xuanzong, believing Bian, issued edicts for Feng's and Gao's executions. After Bian returned to Tong Pass, he first read the edict for Feng's execution. Feng was beheaded, and upon the completion of that execution, Bian then read the second edict ordering Gao's execution. Gao cried out:
The soldiers cried out for Gao as well, but Bian still beheaded Gao. As Gao was to be killed, he looked at Feng's body and stated:
Gao is also considered historically important by many Chinese and Koreans since he led the Tang army in the Battle of Talas even though his Tang army was outnumbered. Despite being the commander of the losing side, the battle helped spread paper and compass to the rest of the world. With the help of paper, which was introduced to Europe around the 1300s, made much foreign knowledge available to more Europeans, and ultimately bringing the Renaissance in Europe. The compass, which spread to Europe through the Muslim World, became an important tool in navigation and led the way to the Age of Exploration.
Gao's defeat, which marked the end of Tang's expansion to the west, was partially fictionalized by the modern Chinese historian Bo Yang in the short story The Tashkent Massacre -- the Chinese Were Cursed Here! (塔什干屠城 -- 就在這裡, 中國人受到詛咒!), in which he gave a fictional curse by the queen of Shi, cursing Tang and the Chinese for eternity for Gao's treachery.