Dunlap served as a member of the Maine House of Representatives from 1821 to 1823.
He served as president of the board of overseers of Bowdoin College from 1821 until his death.
He served as member of the state militia, and was delegated to receive General Lafayette when he visited Maine in 1824.
Dunlap served in the State Senate 1824-1828 and 1831–1833, including three years as Senate President, in 1827, 1828, and 1831. He is, as of 2020, the only person to serve non-consecutive terms as Senate President.[2] In between his Senate terms, he was a member of the Executive Council of Maine. He served four one-year terms as Governor of Maine from 1834 to 1838.
He served as chairman of the Committee on Public Expenditures (Twenty-ninth Congress).
He served as collector of customs in Portland, Maine, in 1848-49, and postmaster of Brunswick in 1853-57.
Death and burial
Dunlap died in Brunswick, Maine, October 20, 1859. He was interred in Pine Grove Cemetery.