In the revolution of 1688, Sir William took the side of the Prince of Orange, and was rewarded by being appointed one of the ordinary lords of session (22 October 1689), and later a member of the privy council. In 1694, he was created baronet of Nova Scotia. In 1704, he was nominated one of the lords of justiciary in the room of Lord Aberuchil. By a charter under the great seal dated 20 April 1704, and ratified by parliament 14 September 1705, the baronies of Anstruther and Ardross and the office of bailliary of the lordship of Pittenweem, with certain minor estates, rights, and privileges, and the office of carver and master of the household to her majesty and her heirs, were granted to Sir William Anstruther and his heirs for ever. Sir William Anstruther was strongly in favour of the union, and his name appears frequently in the division lists during the period when the question was agitating the Scotch parliament.