Danvers was ordered by the parliament to receive the Dutch ambassadors late in 1644, and on 10 October 1645 was returned to the house as member for Malmesbury in the place of Anthony Hungerford, disabled to sit. He took little part in the proceedings of the house, but was appointed a member of the commission nominated to try the king in January 1649. He was only twice absent from the meetings of the commission, and signed the death-warrant. In February of the same year Danvers was given a seat on the council of state, which he retained till the council's dissolution in 1653. He died at his house at Chelsea in April 1655, and was buried at Dauntsey. His name was in the Act of Attainder passed at the Restoration.