He was a member of the Maine Board of Agriculture and later the master of the Maine State Grange (1897–1907). In 1908, he launched an unsuccessful campaign to become governor, losing to Republican candidate Bert M. Fernald. In 1911, he was appointed as chairman of the Board of State Assessors, but resigned after being appointed and later elected Senator, filing the vacancy caused by the death of William P. Frye. Gardner served from September 23, 1911, until March 3, 1913, when he lost his bid for re-election. During this time, Gardner served in the Senate with fellow Democrat Charles Fletcher Johnson. It marked the first time since 1853 that two Democrats represented Maine in the United States Senate.
Following this defeat, he was appointed a member of the International Joint Commission created to prevent disputes between Canada and the United States over shared boundary waters. Later he became chairman of the American delegation, serving until his retirement in 1923.
Gardner returned to Rockland and later moved to Augusta, where he died. He is interred in the Achorn Cemetery in Rockland.