Fu was later charged with the operation of military farming settlements in the Longyou (隴右, modern eastern Gansu) region, and he brought Niu with him as an aid.
Early in the Kaiyuan era (713-741) of Emperor Xuanzong of Tang, the general Wang Junchuo (王君㚟) served as the jiedushi, a military commissioner, of Hexi (河西, headquartered in Wuwei, Gansu).
In 727 Wang and Song were killed in an ambush by the Uyghur tribal leader Yaoluoge Hushu (藥羅葛護輸), but Niu was able to escape.
Subsequently, Niu and Pei Kuan (裴寬) served under the general Xiao Song, the jiedushi of Hexi who replaced Wang.
While serving as jiedushi, Niu was known to be frugal and saved a large surplus for the governmental treasury, and also had good armor and weapons made.
He wanted to promote Niu to minister of defense (兵部尚書, Bingbu Shangshu) and wanted to create him a title—both actions were opposed by the chancellor Zhang Jiuling, on the basis that Niu, not learned, was unsuitable to be minister of a major ministry, and that being honest and frugal were part of his responsibility, not something that should be awarded with a title.
He made Niu the minister of public works (工部尚書, Gongbu Shangshu) and designated him as Tong Zhongshu Menxia Sanpin (同中書門下三品), making him a chancellor de facto, to serve alongside Li Linfu, while still letting him keep the post in Shuofang.
Later that year the deputy chief judge of the supreme court, Xu Jiao (徐嶠), submitted a flattering report to Xuanzong, pointing out that capital punishment had become almost unnecessary due to the peacefulness of his reign.
It was also around this time that a revision of the laws, led by Li Linfu, Niu, and the officials in charge of the justice system, was completed.