Governor
Sullivan received the Republican nomination for governor in 1797 and 1798, but lost to Federalist Increase Sumner (in 1798 by a landslide after the XYZ Affair lent strength to the Federalist cause). Republicanism eventually began gaining ground in Massachusetts, and Sullivan was again nominated in 1805 and 1806 for governor, losing both times to the popular incumbent Governor Caleb Strong. In 1806 the Republicans gained control of the Massachusetts legislature, which managed to very nearly deny Strong a narrow victory. With fewer than 200 votes in the balance, the Republican-controlled legislature scrutinized the returns in a partisan manner, discarding ballots that had misspelled Strong's name while retaining those that misspelled Sullivan's and performing tallies in ways that favored their candidate. This process concluded with a finding that Strong in fact lacked a majority of votes, which was what was then required to carry the election, as opposed to the modern plurality requirement. Strong's Federalist allies in the legislature were able to publicize the partisan nature of the analysis, resulting in a hostile public backlash. He was proclaimed the winner after further, less biased, analysis corrected the count in his favor. In 1807 Sullivan again faced Strong, but was this time decisively victorious, carrying the eastern counties (present-day Maine) by a wide margin amid a series of Republican victories throughout New England.
Although Sullivan sought in some ways to be a moderate voice in the highly partisan disagreements between Federalists and Republicans, he supported the policy of President Thomas Jefferson in embargoing trade with Great Britain and France, who were then embroiled in the Napoleonic Wars. The Embargo Act of 1807 had a significant negative impact on shipping interests based in Massachusetts ports, and Federalists sought to use this, and the threats of war emanating from the Jefferson administration, to unseat Sullivan in 1808. Federalist Senator Timothy Pickering wrote an open letter raising the specter of war and charging Jefferson with failing to publish critical documents in ongoing negotiations. He then asked Sullivan to formally send it to the state legislature, with the view that this would imply Sullivan's agreement with its content. Sullivan refused, after which Federalists used that fact to charge that Republicans generally were withholding damaging information. Sullivan's defense included letters by Senator John Quincy Adams countering the Federalist charges. While this was sufficient to ensure Sullivan's reelection in 1808, control of the legislature was returned to the Federalists. Republicans were unhappy with Sullivan's handling of the political attacks, and for his refusal to remove Federalists from patronage positions in the government.
The Federalist legislature immediately launched attacks on Sullivan and the Republicans, which Sullivan was not immediately able to respond to. In the spring of 1808, before the May opening of the legislature, Sullivan's health began to decline (epilepsy and an "organic disease of the heart"), so he was unable to seize the initiative. When he finally made his speech to the assembly, he failed to respond to the political aspects of the dispute, and called for national unity in dealing with outside interests. His warnings to Jefferson on the nature of the contentious disputes going on in the state were attributed by Jefferson to his declining mental state. Cognizant of Sullivan's precarious health, the Federalists sought a delay in electing a slate of electors for the Electoral College in the 1808 presidential election. Sullivan, who would have vetoed a slate of Federalist electors (as they were then chosen by the legislature and not by popular vote, the Federalist legislative majority would have assured this), he acquiesced in the hopes that elective actions in other states would moot the decision made in Massachusetts. Sullivan also came under criticism by political partisans on both sides for issuing large numbers of exemptions to the embargo, ostensibly to avoid civil strife in the event of a grain shortage.
When the legislature met in November, it rejected a proposal by Sullivan that popular elections determine the state's electoral slate, and instead chose a Federalist slate supporting Charles Cotesworth Pinckney for president in a vote boycotted by many Republicans. Based on widespread opinion that the Federalists were likely to lose the presidential election, Sullivan, his health failing, forwarded the electoral votes on to Congress. He died in office on December 10, 1808, aged 64, and was interred in Boston's Granary Burying Ground in a tomb shared by colonial governor Richard Bellingham.