 In 681, Pei Yan became "Shizhong" (侍中), the head of the examination bureau and a post considered one for a chancellor.Later that year, he was involved in a dispute with the general Pei Xingjian (裴行儉), as Pei Xingjian had earlier that year defeated the Tujue chief Ashina Fu'nian (阿史那伏念) and induced Ashina Fu'nian to first capture his confederate Ashide Wenbo (阿史德溫博) and then surrender, promising Ashina Fu'nian that he would be spared if he did so.However, Pei Yan was said to be jealous of Pei Xingjian, and he reported that Ashina Fu'nian was only forced to surrender due to military pressure by Pei Xingjian's deputies Zhang Qianxu (張虔勗) and Cheng Wuting (程務挺), advocating that Ashina Fu'nian should be put to death.