|Official of Cao Wei|
|Courtesy name||Zhaoxian (Chinese: 昭先; pinyin: Zhāoxiān; Wade–Giles: Chao-hsien)|
Bi Gui's father, Bi Zili (畢子禮),[notes 1] served as a Colonel of Agriculture (典農校尉) in the late Eastern Han dynasty during the reign of Emperor Xian. Bi Gui, who was from Dongping Commandery (東平郡; covering parts of present-day Shandong and Henan), was known for his talent since he was young.
When Cao Rui was still the crown prince, Bi Gui served in the Imperial Academy (文學). He was appointed as a Chief Clerk (長史) in the final years of the reign of Cao Pi, the first ruler of Wei. In 227, Cao Rui ascended the throne upon the death of his father, Cao Pi. Bi Gui became very wealthy as he not only served as a "Gentleman of the Yellow Gate" (黃門郎), but also had his son married to a Wei princess.
Bi Gui was appointed as the Inspector (刺史) of Bing Province later and was known for behaving arrogantly while he was in office. Around the time, the Xianbei tribes in the north often raided Wei's border and killed Wei's citizens. Around 233, Budugen, a Xianbei chieftain who had initially submitted to Wei, was discovered to be secretly maintaining contact with Kebineng, another Xianbei leader who had been staging raids at the Wei border. Bi Gui wrote a memorial to the Wei court, requesting for permission to attack the Xianbei and pressure Budugen into remaining loyal to Wei. Cao Rui read the memorial and felt that it was unwise to attack the Xianbei at the time because it would only result in Budugen and Kebineng becoming more united. He issued an order to Bi Gui, ordering the latter to not advance beyond Juzhu (句注). However, Bi Gui received the order too late as he had already led an army past Juzhu and was garrisoning at Yinguan (陰館). He ordered his deputies Su Shang (蘇尚) and Dong Bi (董弼) to lead their forces to attack the Xianbei. Kebineng sent about 1,000 horsemen to reinforce Budugen. They encountered the Wei army led by Su Shang and Dong Bi and clashed at Loufan (樓煩). The Wei forces were defeated and both Su Shang and Dong Bi were killed in action. Budugen rebelled against Wei and led his forces to join Kebineng and they raided Wei's border together. The Xianbei were driven away later by an army led by the Wei general Qin Lang. The Wei official Jiang Ji suggested to Cao Rui to reassign Bi Gui to another province on the grounds that Bi was not competent enough to govern Bing Province, an important location in Wei.
During the Zhengshi era (240–249) in the reign of Cao Fang (Cao Rui's successor), Bi Gui was consecutively appointed as "Central Protector of the Army" (中護軍), "Palace Attendant" (侍中), "Imperial Secretary" (尚書) and "Director of Retainers" (司隷校尉). He became a close aide to the Wei regent Cao Shuang, who often heeded his advice. Bi Gui, Ding Mi (丁謐) and Cao Shuang's other aides urged Cao to be wary of his co-regent Sima Yi, whom they considered a threat to their lord. In 249, Sima Yi successfully seized power from Cao Shuang in the Incident at Gaoping Tombs and had Cao and all his associates arrested. Bi Gui, Cao Shuang and Cao's other aides were executed along with their families for alleged treason.
- "Zili" was actually the courtesy name of Bi Gui's father. His personal name was not recorded in history.
- (南陽何晏、鄧颺、李勝、沛國丁謐、東平畢軌咸有聲名，進趣於時，明帝以其浮華，皆抑黜之；及爽秉政，乃復進叙，任為腹心。) Sanguozhi vol. 9.
- (魏略曰： ... 畢軌，字昭先。父字子禮，建安中為典農校尉。軌以才能，少有名聲。) Weilue annotation in Sanguozhi vol. 9.
- (明帝在東宮時，軌在文學中。黃初末，出為長史。明帝即位，入為黃門郎，子尚公主，居處殷富。) Weilue annotation in Sanguozhi vol. 9.
- ([青龍元年 ... 六月 ...] 保塞鮮卑大人步度根與叛鮮卑大人軻比能私通，并州刺史畢軌表，輒出軍以外威比能，內鎮步度根。帝省表曰：「步度根以為比能所誘，有自疑心。今軌出軍，適使二部驚合為一，何所威鎮乎？」促勑軌，以出軍者慎勿越塞過句注也。比詔書到，軌以進軍屯陰館，遣將軍蘇尚、董弼追鮮卑。比能遣子將千餘騎迎步度根部落，與尚、弼相遇，戰於樓煩，二將敗沒。步度根部落皆叛出塞，與比能合寇邊。遣驍騎將軍秦朗將中軍討之，虜乃走漠北。) Sanguozhi vol. 3.
- (遷并州刺史。其在并州，名為驕豪。時雜虜數為暴，害吏民，軌輒出軍擊鮮卑軻比能，失利。中護軍蔣濟表曰：「畢軌前失，旣往不咎，但恐是後難可以再。凡人材有長短，不可彊成。軌文雅志意，自為美器。今失并州，換置他州，若入居顯職，不毀其德，於國事實善。此安危之要，唯聖恩察之。」) Weilue annotation in Sanguozhi vol. 9.
- (至正始中，入為中護軍，轉侍中尚書，遷司隷校尉。素與曹爽善，每言於爽，多見從之。) Weilue annotation in Sanguozhi vol. 9.
- (初，宣王以爽魏之肺腑，每推先之，爽以宣王名重，亦引身卑下，當時稱焉。丁謐、畢軌等旣進用，數言於爽曰：「宣王有大志而甚得民心，不可以推誠委之。」由是爽恒猜防焉。禮貌雖存，而諸所興造，皆不復由宣王。宣王力不能爭，且懼其禍，故避之。) Annotation in Sanguozhi vol. 9.
- (於是收爽、羲、訓、晏、颺、謐、軌、勝、範、當等，皆伏誅，夷三族。) Sanguozhi vol. 9.
- Chen, Shou. Records of the Three Kingdoms (Sanguozhi).
- Pei, Songzhi. Annotations to Records of the Three Kingdoms (Sanguozhi zhu).