Reilly was elected as a Democrat to the Forty-fourth and Forty-fifth Congresses. He resumed the practice of law in Pottsville. He was a delegate to the 1880 Democratic National Convention. He was an unsuccessful candidate for law judge of Schuylkill County in 1881 and again in 1882, and an unsuccessful Democratic candidate for election in 1884 to the Forty-ninth Congress.
Reilly was again elected to the Fifty-first, Fifty-second, and Fifty-third Congresses. He served as chairman on the United States House Committee on Pacific Railroads during the Fifty-second and Fifty-third Congresses. He was an unsuccessful candidate for reelection in 1894. He served as United States marshal for the eastern district of Pennsylvania from 1896 to 1900. He again resumed the practice of law in Pottsville and was an unsuccessful candidate for justice of the superior court in 1913. He died in Pottsville in 1924. Interment in St. Patrick’s No. 3 Cemetery.