In 2002, Dewar organized a Community Forum on Public Education. He has also been actively involved with the Coalition for a Healthy Ottawa, the Partnership for a Pesticide Bylaw, the Old Ottawa East Community Association, and Fair Vote Canada, and he has served on the board of directors of the Ottawa Community Immigrant Services Organization.[12]

Dewar ran for the New Democratic nomination in Ottawa Centre for the 2004 federal election.[17] Several weeks after Dewar started his campaign, former NDP leader Ed Broadbent came out of retirement to also seek the nomination.[4] After Broadbent won, Dewar went on to volunteer for Broadbent's successful campaign in the general election, playing a major role in organizing the NDP election day effort.[18]

In order to care for his ailing wife, Broadbent decided not to seek re-election.[19] Dewar won the proceeding nomination contest on June 22, 2005 on the first ballot, defeating NDP caucus Research and Communications Director Jamey Heath, who was the riding's candidate in the 1997 election, lawyer and film producer Tiffani Murray, and Ottawa Citizen automotive columnist Shannon Lee Mannion.[20][21]

In April 2009, Dewar reintroduced legislation to protect Gatineau Park. If passed the act would have provided legislated boundaries for the park, prevented removal of land from the park, created a mechanism for expanding the park, and mandated the National Capital Commission to acquire private lands in the park through a right of first refusal process.[22] However, he was later criticized in the media for having abandoned his commitments on the park, for supporting the Conservative government's legislation, and for not attending the committee studying that legislation.[23][24]

Dewar was re-elected in the 2011 federal election, winning 52% of the popular vote.[25] The NDP formed the Official Opposition following the election and Dewar was named the Critic for Foreign Affairs.[26] While acting as foreign affairs critic, Dewar took a position in favour of the UN Arms Trade Treaty not exempting weapons designed for sport or hunting, an exemption that the Canadian government was proposing at international talks. Dewar explained in media interviews that in his view it was important that the UN treaty cover all small arms because of the effects that they have had in conflicts in Africa.[27]

Dewar criticized the government's decision to close its embassy in Iran, saying it was "bad diplomacy".[28]

Dewar was one of thirteen Canadians banned from traveling to Russia under retaliatory sanctions imposed by Russian President Vladimir Putin in March 2014.[29]

Dewar was defeated in the 2015 federal election by Liberal candidate Catherine McKenna.

Following the death of Jack Layton in August 2011, Dewar was seen as a potential candidate to succeed him as leader.[30] On October 2, 2011, Dewar announced his candidacy for the leadership of the New Democratic Party.[31] Dewar was considered to be among the leading candidates in the seven-person race; however, his lack of fluency in French was seen as a major obstacle.[32][33][34] While internal polling released by his campaign showed he was among the top three candidates and had strong growth potential, on election day he finished fifth out of seven candidates on the first ballot with 7.5% of the vote. Following the first ballot, he withdrew his candidacy and did not endorse any other candidates.[35][36]