The Red Sox rallied from an early three-run deficit and moved within a game of Toronto in their bid to escape the basement in the American League East.
Boston tied it in the fourth on a three-run homer by Ryan Lavarnway and the Red Sox took a 5-3 lead in the fifth on a two-run single from Daniel Nava.
Single runs by Toronto in the sixth and eighth allowed the Blue Jays to deadlock the contest, but Boston came up with three hits in the ninth to go back in front.
That brought up Gomez, who drove in both runners with a triple to right. Lavarnway then delivered Gomez with a sacrifice fly.
Toronto lost for the third time in four contests after putting together a four-game winning streak.
North Korea sends threat -- by fax -- to South Korea
Prince William mocks Prince Harry, calls Kate 'babykins' in 'hacked' voicemails