William O. Douglas (1898-1980), who served 36 years (1939-75), was the Supreme Court Justice who served the longest term.
Four justices served 34 years: John Marshall (1801-35); Stephen J. Field (1863-97); Hugo L. Black (1937-71); and William J. Brennan, Jr. (1956-90).