He studied law in Canton, was admitted to the bar in 1880 and commenced practice in Towanda, Pennsylvania. For several years he was chairman of the Republican committee of Bradford County, Pennsylvania. He was elected prothonotary of Bradford County in 1893 and reelected in 1896. He was appointed assistant United States district attorney for the middle district of Pennsylvania in 1903.
Lilley was elected as a Republican to the Fifty-ninth Congress. He was an unsuccessful candidate for reelection in 1906. He engaged in the practice of his profession until his death in Towanda in 1915, aged 64; he was interred in Oak Hill Cemetery.