Parliamentarian
At the general election in March 1768, Dunning, through the influence of Lord Shelburne, was returned to parliament as one of the members for the borough of Calne. Though solicitor-general, he took no part in the debate on the expulsion of John Wilkes from the house, and was absent from the division. On 9 January 1770 Dunning both spoke in favour of the amendment to the address urging an inquiry into the causes of "the unhappy discontents which at present prevail in every part of his majesty's dominions"; and a few days later tendered his resignation. On 19 March he spoke on the side of the minority in the debate on the remonstrance of the city of London. After some delay Edward Thurlow was appointed solicitor-general on 30 March 1770.
On 12 October 1770 the freedom of the city of London was voted to Dunning. In the debate which took place on 25 March 1771, Dunning made a speech against Welbore Ellis's motion to commit Alderman Richard Oliver to the Tower of London, in which he denied the right of the house to commit in such a case. Dunning opposed the third reading of the bill for regulating the government of Massachusetts Bay on 2 May 1774. At the general election in October 1774 he was re-elected for Calne, and continued to oppose the ministerial policy towards the American colonies. On 6 November 1776 he supported Lord John Cavendish's defeated motion for the "revisal of all acts of parliament by which his majesty's subjects in America think themselves aggrieved". In the next session Dunning, continued to oppose the ministry, and was instrumental in obtaining the insertion of a clause in the bill for the suspension of habeas corpus, which lessened its scope.
On 14 May 1778 Dunning seconded Sir George Savile's motion for leave to bring in a bill for the relief of Roman Catholics; and it was on his amendment that the house unanimously voted that a monument should be erected in Westminster Abbey to the memory of the Earl of Chatham. On 21 February 1780 he supported Savile's motion for an account of crown pensions; and on 6 April moved his famous resolutions that "the influence of the crown has increased, is increasing, and ought to be diminished", and that "it is competent to this house to examine into and correct abuses in the expenditure of the civil list revenues, as well as in every other branch of the public revenue, whenever it shall appear expedient to the wisdom of the house so to do". In the teeth of Lord North's opposition, the first resolution (with a slight addition) was carried by 233 to 215, and the second agreed to without a division. Dunning a few weeks later proposed an address to the king requesting him not to dissolve the parliament; he found himself in a minority of 51.
At the general election in September 1780 Dunning was again returned for Calne, and proposed the re-election of Sir Fletcher Norton as Speaker, but Cornwall, the ministerial candidate, was elected by 203 to 134. In February 1782 he supported Conway's motion against the further prosecution of the American war, and a month later announced that arrangements were being made for the formation of a new ministry. On 27 March 1782 Dunning, with Lord John Cavendish, Charles James Fox, Edmund Burke, and Augustus Keppel, was admitted to the privy council, and on 8 April was created Baron Ashburton of Ashburton in the county of Devon. The king retained Thurlow as Lord Chancellor, and Dunning was sworn in as chancellor of the Duchy of Lancaster on 17 April. He continued in the cabinet after Lord Rockingham's death, and was consulted by Shelburne in legal matters, but took little part in debates in the House of Lords.