William Lewis was born in Chester County, Pennsylvania, the son of Josiah Lewis. He was educated at home until the age of seventeen, when he went to Philadelphia to enroll at the Friends’ Public School to study Latin and then to study law under Nicholas Waln. He began his lifelong career as a lawyer after he was admitted to the bar in 1773.
Lewis was elected to the Pennsylvania legislature in 1787 and then to the state Constitutional Convention in 1789, the same year he was appointed attorney of the United States for the district of Pennsylvania. This post was followed with a 1791 appointment as federal judge in the court of the eastern district of Pennsylvania. He served only until 1792, when he resigned to return to private practice.
After the Revolutionary War Lewis became especially known for his skill in defending people accused of treason. A leading Quaker lawyer and one of the best American defense lawyers of his day, Lewis leaves a number of legacies, but perhaps most important to him would be his role in drafting and passing the 1780 act for the gradual abolition of slavery in Pennsylvania.
In 1789 Lewis was elected a trustee of the College and Academy of Philadelphia. After the 1791 union of the College and the University of the State of Pennsylvania, he became a trustee of the University of Pennsylvania, serving until his death in 1819.