 In 1862 he affiliated with the Republican Party, and was a delegate to six Republican National Conventions.He was a delegate at large to the convention to revise the constitution of Pennsylvania in 1872 and 1873.Lilly was elected as a Republican to the Fifty-third Congress and served until his death in Mauch Chunk, Pennsylvania.