Franklin Delano Roosevelt, who was elected in 1932, 1936, 1940 and 1944. He died in April 1945, three months after starting his fourth term of office.
After his death, an amendment was passed to the Constitution to limit presidfents to a maximum of two elected term of office, although that limit did not apply to Harry S Truman who was president at the time (1945-53).
Although presidents can be elected to only two terms, they are allowed to serve up to half of a term of a predecessor before being elected in their own right. For example, Lyndon Johnson became President on 22 November 1963, was elected in November 1964 and retired on 20 January 1969. He chose not to stand for re-election in 1968, but he could have done if he wished. Had he done so, he could have been President until 20 January 1973, i.e. a total of 9 years 2 months. So the maximum theoretical time that a President can be in office is 10 years.