On 10 April 1668 Wright was returned to parliament for King's Lynn. In 1678 he was appointed counsel for the University of Cambridge, and in August 1679 he was elected deputy recorder of the town. In October 1678 he fell under suspicion of being concerned in the Popish Plot, Coleman having been in his company the Sunday before he was committed. On 31 October the matter was brought by the Speaker before the House of Commons, which ordered Wright’s chambers in Lincoln's Inn and his lodgings to be searched. As nothing was found to incriminate him, he was declared completely exculpated. In Easter 1679 he was made a Serjeant, and on 12 May 1680 he was made a King's Serjeant. He was knighted on 15 May, and in 1681 was appointed chief justice of Glamorgan.
At this time his fortunes were at low ebb. He had made the acquaintance of Jeffreys, and had acquired his regard, it is said, by his ability as a mimic. He went to him and implored his assistance. Jeffreys had recourse to the king, and in spite of the objections of Francis North, who was then Lord Keeper of the Great Seal, procured his nomination on 27 Oct. 1684 as a Baron of the Exchequer. On 10 Feb. 1684-5 he was elected Recorder of Cambridge. James II selected him to accompany Jeffreys on the western assize after Monmouth's rebellion, and on his return removed him on 11 Oct. to the King's Bench. In 1686, in the case of Sir Edward Hales, Wright gave an opinion in favour of the dispensing power, when consulted by Sir Edward Herbert, previous to judgment being given in court in favour of Hales.
In October 1687 Wright was sent to Oxford as an ecclesiastical commissioner with Thomas Cartwright (1634-1689) and Sir Thomas Jenner on the famous visitation of Magdalen College, Oxford when all the fellows but three were expelled for resisting the royal authority, and declared incapable of holding any ecclesiastical preferment. When the president of Magdalen, John Hough, protested against the proceedings of the commission, Wright declared that he would uphold his majesty's authority while he had breath in his body, and bound him over in a thousand pounds to appear before the king's bench on the charge of breaking the peace.
On 29 June 1688 Wright presided at the trial of the Seven Bishops. Although he so far accommodated himself to the king as to declare their petition a libel, he was overawed during the trial by the general voice of opinion and the apprehension of an indictment. In the words of a bystander he looked as if all the peers present had halters in their pockets. He conducted the proceedings with decency and impartiality. At an early stage the evidence of publication broke down, and Wright was about to direct the jury to acquit the prisoners when the prosecution was saved by the testimony of Sunderland. In his charge, while declaring in favour of the right of the subject to petition, he gave it as his opinion that the particular petition before the court was improperly worded, and was, in the contemplation of the law, a libel. He failed, however, to pronounce definitely in favour of the dispensing power of the crown. For this omission his dismissal was afterwards contemplated, and he was probably saved by the difficulty of finding a successor.
In December 1688 the Prince of Orange caused two impeachments of high treason against Jeffreys and Wright to be printed at Exeter. Wright was accused among other offences of taking bribes “to that degree of corruption as is a shame to any court of justice”. He continued to sit in court until the flight of James on 11 Dec. He then sought safety in concealment, and on 10 Jan. 1688-9 addressed a supplicating letter to the Earl of Danby asserting that he had always opposed popery, and had been compelled to act against his inclinations. His hiding-place in Old Bailey was discovered by Sir William Waller (d. 1699) on 13 February , and he was taken before Sir John Chapman, the Lord Mayor of London, who committed him to Newgate on the charge that, “being one of the judges of the court of king's bench, he had endeavoured the subversion of the established government by alloweing of a power to dispence with the laws; and that hee was one of the commissioners for ecclesiastical affairs.” On 6 May he was brought before the House of Lords for his action in regard to the Earl of Devonshire: but, although his overruling the earl's plea of privilege and committing him to prison was declared a manifest breach of privilege of parliament, no further action was taken against him. On 18 May he died of fever in Newgate. In the debate on the act of indemnity on 18 June it was determined to except him from the act in spite of his decease. His name, however, does not appear in the final draft of the act.