Emperor Xuanzong's son and crown prince Li Heng, however, did not follow him to Chengdu but fled to Lingwu instead, where he was declared emperor (as Emperor Suzong of Tang). When the news reached Emperor Xuanzong, he recognized Emperor Suzong as emperor and took the title of Taishang Huang (retired emperor). He sent a number of officials, including Zhang Gao, to attend to Emperor Suzong, and in 757, Zhang reached Emperor Suzong's makeshift court at Fengxiang (鳳翔, in modern Baoji, Shaanxi). As Emperor Suzong was impressed by Zhang's suggestions, he made Zhang Jianyi Daifu (諫議大夫), a consultant at the examination bureau. He soon further promoted Zhang to be Zhongshu Shilang (中書侍郎), the deputy head of the legislative bureau (中書省, Zhongshu Sheng) and gave him the designation Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事), making him a chancellor de facto. At that time, Emperor Suzong retained several hundred Buddhist monks to recite sutras day and night, hoping to draw divine favor, and their voices carried within and without the makeshift palace. Zhang, wanting to end the practice, spoke to Emperor Suzong:[4]
An emperor can put down a rebellion and calm his people only by improving his virtues. One cannot make the realm peaceful by simply giving food to monks.
Emperor Suzong was said to agree with his words, but historical accounts did not indicate whether the practice stopped. Meanwhile, as Emperor Suzong believed Zhang to be capable in both civilian and military matters, he soon made Zhang the military governor (jiedushi) of Henan Circuit (河南, roughly modern Henan and Shandong) and commander of the forces in the region, replacing Helan Jinming (賀蘭進明). Zhang knew that, at that time, the general Zhang Xun and the city that he was defending, Suiyang, were under heavy siege, and he therefore tried to march his troops at twice the speed to try to save Suiyang. He also ordered the generals in the region to report to Suiyang to try to save it, but by the time that he arrived in the locale, Suiyang had already fallen, and Zhang Xun was killed by the Yan general Yin Ziqi (尹子奇). In anger, Zhang Gao summoned one of the generals who had disobeyed his order and who had refused to try to save Suiyang, Luqiu Xiao (閭丘曉) and executed Luqiu by caning. Subsequently, after a joint Tang and Huige force recaptured the Tang eastern capital Luoyang (the force had recaptured Chang'an earlier), Zhang and five military governors under his command, Lu Jiong (魯炅), Lai Tian, Li Zhi (李祇) the Prince of Wu, Li Siye, and Li Huan (李奐), recaptured the commanderies throughout the Henan and Hedong (河東, i.e., modern Shanxi) region, except for two commanderies where the Yan generals Neng Yuanhao (能元皓) and Gao Xiuyan (高秀巖) held out. He was created the Duke of Nanyang.
Meanwhile, Tang forces were putting An Lushan's son and successor An Qingxu under siege at Yecheng, and with the siege proceeding and the last major remaining Yan general, Shi Siming, submitting his post of Fanyang (范陽, in modern Beijing) to Tang, it appeared that the realm would be soon peaceful. However, Zhang distrusted Shi, believing that Shi was merely buying time and would soon rebel himself; he thus advised Emperor Suzong to use extreme caution with regard to Shi. He also distrusted another Tang general, Xu Shuji (許叔冀) and suggested that Emperor Suzong recall Xu to the capital. However, Emperor Suzong trusted the reports of eunuchs he sent to meet with Shi and Xu, which stated that both Shi and Xu were trustworthy. In spring 758, Emperor Suzong thus removed Zhang from his posts as chancellor and military governor, instead sending him to Jing Prefecture (荊州, roughly modern Jingzhou, Hubei) to serve as its defender. (Zhang's warnings proved to be prescient, however, as Shi soon rebelled, and after Shi's forces had some preliminary victories over Xu, Xu surrendered to him.) Zhang was soon recalled serving on the staff of Emperor Suzong's crown prince Li Yu and Zuo Sanqi Changshi (左散騎常侍), a high-level advisor at the examination bureau. In 761, however, after a plot to make Emperor Suzong's cousin Li Zhen (李珍) the Prince of Qi emperor was discovered, as Zhang had previously purchased a mansion from Li Zhen, he was considered Li Zhen's associate. Emperor Suzong thus exiled him to Chen Prefecture (辰州, roughly modern Huaihua, Hunan) to serve as the census officer.