After graduating, Lilly practiced medicine in Lambertville. He was elected as the first Mayor of Lambertville, New Jersey serving in office from 1849 to 1852.[1]
Lilly was elected as a Democrat to the Thirty-third Congress, serving in office from March 4, 1853, to March 3, 1855. In Congress, he was chairman of the committee on expenditures in the Post Office Department.[1]
Lilly served as director of the Board of Chosen Freeholders of Hunterdon County for eight years, and was brigadier general of the New Jersey Militia. He was appointed by President James Buchanan as consul general of the United States to British India, with residence in Calcutta, from January 3, 1861, and served until July 4, 1862, when he resigned.[1]
Lilly was judge of the Court of Common Pleas of Hunterdon County from 1868–1873, and was one of the members of the board of managers of the New Jersey Insane Asylum in 1871. He was a judge of the New Jersey Court of Errors and Appeals, then the state's highest court, and also a member of the State board of pardons from 1873 until his death in Lambertville on April 3, 1880.[1] He was president of the New Jersey Medical Society and the District Medical Society of Hunterdon County.[2] He was commissioner of the New Jersey Lunatic Asylum.[2]
Personal life
Lilly married his first wife in October 1839. He married his second wife on February 12, 1860. Both of his wives predeceased him.[2]
Lilly died on April 3, 1880, in Lambertville. He was interred in Mount Hope Cemetery in Lambertville.[1]