He served as Speaker of the House from 1977 until his retirement in 1987, making him the only Speaker to serve for five complete consecutive Congresses, and the second longest-serving Speaker in U.S. history after Sam Rayburn. O'Neill retired from Congress in 1987 but remained active in public life. 