Hamlin was elected as a Democrat to the Seventy-fourth Congress (January 3, 1935 - January 3, 1937). He served as chairman of the Committee on Memorials (Seventy-fourth Congress). He was an unsuccessful candidate for reelection in 1936 to the Seventy-fifth Congress. He resumed the real estate business and farming in South Portland, Maine, until his death there July 27, 1939. He was interred in Hamlin Cemetery, Standish (Richville), Maine.