It is not known which year Wei Yuanzhong was born, but it is known that his family was from Songzhou. He was originally named Wei Zhenzai, but later changed his name to observe naming taboo for Lady Yang, the mother of Emperor Gaozong's second wife Empress Wu (later known as Wu Zetian). He was a student at the imperial university in his youth, and was said to be unrestrained in his behavior, and did not receive a commission as an official for a long time. During that time, he also learned various military strategies from one Jiang Rong (江融) from Zhouzhi (盩厔, in modern Xi'an, Shaanxi).
Around 678, there were repeated Tufan attacks, and Emperor Gaozong was concerned about them. Wei Yuanzhong went to the eastern capital Luoyang, where Emperor Gaozong was at the time, and submitted a secret petition, making suggestions as to what to do with the Tufan threat—pointing out that at the time, the generals were largely past generals' sons who were not necessarily militarily talented; the reward and punishment system was not being utilized properly; and that the army was being crippled by a then-existent regulation prohibiting the people from keeping horses. Emperor Gaozong was impressed by Wei's petition and made him a secretary at the Palace Library, but gave him an office at the more important legislative bureau (中書省, Zhongshu Sheng) and permitted him to meet the emperor periodically with officials of higher ranks.
Later during Emperor Gaozong's reign, Wei became an imperial censor. On one occasion, Emperor Gaozong asked him, "Which past rulers do the people think I am like?" Wei responded, "King Cheng and King Kang of Zhou, as well as Emperor Wen and Emperor Jing of Han." Emperor Gaozong then asked, "But are there faults?" Wei responded, "Yes. Wang Yifang [(王義方, an official who was demoted for indicting the chancellor Li Yifu, then a favorite of Emperor Gaozong and Empress Wu)] was allowed to die in a remote location. Commentators believed that Your Imperial Majesty was unable to use someone who was able." Emperor Gaozong stated, "I was going to use him when I heard of his death. It was already too late." Wei then responded, "Liu Cangqi [(劉藏器, another official known for having indicted another favorite official of Emperor Gaozong's, Chi Baolin (遲寶琳))] has abilities that had few rivals in the empire, and Your Imperial Majesty knows that. He is now past 70 years old and yet still serves as a minor official at the executive bureau [(尚書省, Shangshu Sheng)]. You sigh at the death of one and yet ignored another." Emperor Gaozong was much embarrassed by Wei's frankness.
Emperor Gaozong died in 683 and was succeeded by his son Li Zhe the Crown Prince (as Emperor Zhongzong), but actual power was in the hands of Empress Wu, as empress dowager and regent. In 684, when Emperor Zhongzong displayed signs of independence, she deposed him and replaced him with his younger brother Li Dan the Prince of Yu (as Emperor Ruizong), but thereafter wielded power even more securely. Later that year, Li Jingye the Duke of Ying rebelled against Empress Dowager Wu at Yang Prefecture (揚州, roughly modern Yangzhou, Jiangsu), claiming as his goal Emperor Zhongzong's restoration, and Empress Dowager Wu sent the general Li Xiaoyi (李孝逸) against Li Jingye. Wei Yuanzhong served as the army auditor. When Li Xiaoyi reached LInhuai (臨淮, in modern Suzhou, Anhui), his subordinate Lei Renzhi (雷仁智) challenged Li Jingye's forces to a battle but was defeated, and Li Xiaoyi, in fear, defended just his camp and did not dare to battle Li Jingye's forces. Wei warned him that by failing to advance, he would cause insecurity in the people's minds, and that he himself might be punished for not advancing. Li Xiaoyi thus advanced, and, under Wei's suggestion, first attacked Li Jingye's brother Li Jingyou (李敬猷). After defeating Li Jingyou, Li Xiaoyi then engaged Li Jingye, but was initially defeated, but under suggestion from Wei and Liu Zhirou (劉知柔), counterattacked and set the grassland on fire. Li Jingye's forces collapsed; he fled and was killed in flight. For his contributions, Wei was made Sixing Zheng (司刑正), a judge at the supreme court (司刑寺, Sixing Si), and then the magistrate of Luoyang County. In 689, when a number of officials were accused by Empress Dowager Wu's secret police official Zhou Xing of protecting Li Jingye's brother Li Jingzhen (李敬真) in his flight, a number of them were executed, and several, including Wei, Zhang Chujin (張楚金), Guo Zhengyi, and Yuan Wanqing (元萬頃), were spared of death at the execution field but exiled to the Lingnan region. It was said that when they were about to be executed, Empress Dowager Wu sent the official Wang Yinke (王隱客), on a fast horse, to head to the execution field to yell, "An imperial edict is here sparing them!" When Wang's voice was heard, the other prisoners were happy and jumping in joy, but only Wei remained sitting quietly, stating, "I do not yet know whether this is true or not." Once Wang arrived, he told Wang to rise, but Wei said, "I will wait until the edict is read." Once Wang read the edict, Wei got up and bowed in thanksgiving, without expression of sorrow or joy. This much impressed the witnesses to the event.
In 690, Empress Dowager Wu had Emperor Ruizong yield the throne to her, and she took the throne as "emperor," establishing a new Zhou Dynasty and interrupting Tang. She recalled Wei Yuanzhong from exile, to again serve as a censor. In 692, however, he, along with the chancellors Ren Zhigu, Di Renjie, and Pei Xingben, and other officials Cui Xuanli (崔宣禮), Lu Xian (盧獻), and Li Sizhen (李嗣真), were falsely accused by the secret police official Lai Junchen of treason. They were arrested and interrogated by torture, with Lai's subordinate Hou Sizhi in charge of interrogating Wei. Wei refused to admit to treason, and Hou reacted by having him dragged on the ground feet-first. Wei sarcastically stated, "I am so unlucky that it is like having fallen from a donkey with my feet stuck to the stirrup, and being dragged by the beast." Hou, in anger, increased the speed of the dragging, and Wei responded, "Hou Sizhi, if you want my head, just cut it off. Do not ask me to admit treason." He further criticized Hou for using vulgar speech unfit for an imperial official—which, oddly, caused Hou to stop the torture and thank him for teaching him to speak properly. Meanwhile, Di was able to hide a secret petition inside clothes that were given back to his family members to be changed, and when the petition reached Wu Zetian, she released them, but exiled them—in Wei's case, to be the magistrate of Fuling County (涪陵, in modern Mianyang, Sichuan).
While Wei was in exile, many people spoke on his behalf, and in 697, Wu Zetian recalled him to serve again as censor. On one occasion, she asked him, "Why do you often get attacked by others?" Wei's response was, "Your subject is just like a deer. The false accusers are just like hunters who want to cut off my flesh for stew. They want to kill me in order to advance in government; it has nothing to do with me."
In 699, Wu Zetian made Wei Fengge Shilang (鳳閣侍郎), the deputy head of the legislative bureau (now renamed Fengge (鳳閣)), and gave him the designation Tong Fengge Luantai Pingzhangshi (同鳳閣鸞臺平章事), making him a chancellor de facto. Throughout the next few years, whenever there were Eastern Tujue and Tufan incursions, Wei would often be put in command of armies to defend against them. It was said that he was careful as a commander and did not have great gains, but also did not have great losses. He was also known for not being apprehensive of Wu Zetian's powerful lover Zhang Yizhi, and on one occasion, when Zhang Yizhi's servant attacked others, he whipped the servant to death, causing much fear in other people's minds for him.
By 703, because Wei's unwillingness to yield to the wishes of Zhang Yizhi and his brother Zhang Changzong, also Wu Zetian's lover, including his punishment of their brother Zhang Changyi (張昌儀) and refusal to promote another brother, Zhang Changqi (張昌期), Zhang Yizhi and Zhang Changzong were angry at him. At that time, Wu Zetian happened to be somewhat ill, and the Zhangs were fearful that if she died, Wei would kill them, and therefore falsely accused Wei and Gao Jian (高戩), a favorite official of Wu Zetian's daughter Princess Taiping, of having said that she was too old and that it would be better for them to support the Crown Prince (Li Zhe, who had by now been recalled from exile to serve in that role and renamed Li Xian and then Wu Xian, and on whose staff Wei also served). Wu Zetian, in anger, arrested Wei and Gao, and was ready to interrogate them before her. The Zhangs persuaded Wei's subordinate Zhang Shuo to corroborate their accusations, but Zhang Shuo, having been persuaded by his colleagues Song Jing, Zhang Tinggui (張廷珪), and Liu Zhiji that he needed to speak the truth, when reaching Wu Zetian's presence, instead revealed that he had never heard Wei say anything of that nature and that he had been asked by Zhang Yizhi and Zhang Changzong to testify that he had. As a result, Wei escaped death, but was exiled to be the sheriff of Gaoyao County (高要, in modern Zhaoqing, Guangdong), while Gao and Zhang Shuo were reduced to commoner rank and exiled as well. Before Wei departed, he said to Wu Zetian, "I am old now, and now I am going to Lingnan. There is less than a 10% chance that I will survive, but Your Imperial Majesty will think of me one day." When she asked why, he pointed to Zhang Yizhi and Zhang Changzong and said, "These two boys will create a disaster." The Zhangs quickly kneeled and claimed that Wei's accusation was false, to which Wu Zetian merely stated, "Wei Yuanzhong, you may go now."
In 705, Wu Zetian was overthrown in a coup, and Zhang Yizhi and Zhang Changzong were killed. Emperor Zhongzong was restored to the throne, and he immediately recalled Wei Yuanzhong and made him the minister of military supplies (衛尉卿, Weiwei Qing) and chancellor with the Tong Zhongshu Menxia Pingzhangshi (同中書門下平章事) designation. He was soon made the minister of defense (兵部尚書, Bingbu Shangshu) with the greater chancellor de facto designation of Tong Zhongshu Menxia Sanpin (同中書門下三品). Later in the year, he was made Shizong (侍中), the head of the examination bureau (門下省, Menxia Sheng) and a post considered one for a chancellor, and then Zhongshu Ling (中書令), the head of the legislative bureau (now again named Zhongshu Sheng) and also a post considered one for a chancellor. There was much expectation by the people that he would help reform government, but it was said that after he became chancellor again, he did not have any particularly good suggestions for Emperor Zhongzong but was instead only going with the flow in the political arena, and the people were disappointed, those in hopes that he would serve as a counterbalance to Wu Zetian's nephew Wu Sansi, who had become powerful as a trusted advisor for Emperor Zhongzong and the lover of his powerful wife Empress Wei. Late in 705, when Wu Zetian died, Wu Sansi altered her will to include the grant of 100 household to serve as Wei Yuanzhong's fief—to which Wei was seen thankfully grieving, leading people to comment that he could no longer serve as a counterbalance to Wu Sansi. During the mourning period that Emperor Zhongzong observed for Wu Zetian, he had Wei Yuanzhong serve as regent for three days, and also created Wei the Duke of Qi.
In 706, a sheriff named Yuan Chuke (袁楚客) wrote a letter to Wei, pointing out that there was much expectation the people had for him, and that it was not proper for him, as a senior chancellor, to be standing by and doing nothing while Wu Sansi and several other officials were leading Emperor Zhongzong astray in his reign. After Wei read Yuan's letter, he was much ashamed, but did little, although he did began to consider whether there was something he could do to Wu Sansi. Later that year, when the sorcerer Zheng Pusi (鄭普思), whom Emperor Zhongzong trusted and whose daughter was a concubine of Emperor Zhongzong's, was accused of treason, Wei spoke in favor of Zheng's execution, even though Emperor Zhongzong wanted to spare Zheng. Emperor Zhongzong, while sparing Zheng's life, was forced to exile him and execute his associates. Also around this time, when Emperor Zhongzong's and Empress Wei's favorite daughter Li Guo'er the Princess Anle asked to become crown princess (to displace her brother Li Chongjun, born of a concubine), Wei opposed it, pointing out that no woman had ever become the heir to an emperor, and also pointed out that there would be no appropriate title for her husband Wu Chongxun (武崇訓, Wu Sansi's son). In anger, Li Guo'er commented rather irreverently:
Wei Yuanzhong is simply a carpenter from east of the mountain [(i.e., east of modern Sanmenxia, Henan)], and he has black feet. What does he know about the affairs of state? If the son of that Wu woman [(i.e., Wu Zetian)] could become Son of Heaven, why cannot a daughter of a Son of Heaven?
Despite the rebuff, Li Guo'er and Wu Chongxun continued to try to have Li Guo'er made crown princess, and also repeatedly insulted Li Chongjun. In 707, Li Chongjun, in anger, started a rebellion and killed Wu Sansi and Wu Chongxun and tried to arrest Li Guo'er, Empress Wei, and Emperor Zhongzong's concubine Consort Shangguan Wan'er, also Wu Sansi's lover, before he was defeated and killed in flight. During Li Chongjun's rebellion, Wei Yuanzhong's son Wei Sheng (魏升) was forced to participate, and at the end of the rebellion, Wei Sheng was also killed. Wei Yuanzhong commented to others, "The prime evil is dead, and even if I were to be cooked in a ding, what would be the harm? I only lament that the Crown Prince has fallen." When these words were reported, Li Guo'er had the chancellors Zong Chuke and Ji Chuna accuse Wei of being complicit in Li Chongjun's rebellion as well and request his execution. Emperor Zhongzong initially only had Wei retire and return to his mansion, but then had him demoted to be the military advisor to the prefect of Qu Prefecture (渠州, roughly modern Dazhou, Sichuan). Zong and Ji continued their accusations, however, and Emperor Zhongzong then demoted Wei further to be the sheriff of Wuchuan County (務川, in modern Tongren Prefecture, Guizhou). When Zong and Ji insisted on Wei's execution, however, Emperor Zhongzong stopped further investigation. While on the way to Wuchuan, however, when Wei reached Fuling (where he had once served as magistrate), he died, and was said to be in his 70s at death.
After Emperor Zhongzong's death in 710—a death traditional historians believed to be a poisoning by Empress Wei and Li Guo'er—a coup led by Princess Taiping and Li Longji the Prince of Linzi, the son of Li Dan the Prince of Xiang (the former Emperor Ruizong) overthrew Empress Wei and Li Guo'er and restored Emperor Ruizong to the throne. Emperor Ruizong had Wei's titles restored and had him reburied near Emperor Zhongzong's tomb.