Sperry was a member of the Connecticut House of Representatives in 1876. Later, he was elected as a Democrat to the Fifty-second and Fifty-third Congresses (March 4, 1891 - March 3, 1895). He was an unsuccessful candidate for reelection in 1894 to the Fifty-fourth Congress. After Congress, he again resumed the practice of his profession in Hartford, Connecticut. He died at East Windsor Hill, town of South Windsor, Connecticut in 1922 and was buried in South Windsor Cemetery.