BOSTON -AP- Opening his final weekend with yet another game-winning homer, David Ortiz lined a two-run shot into the right-field stands to break a seventh-inning tie and help the Boston Red Sox beat the Toronto Blue Jays 5-3 on Friday night.The AL East champion Red Sox snapped a three-game losing streak and stayed one game ahead of Cleveland in the race for home-field advantage for the playoffs. The Blue Jays fell one game behind Baltimore in the wild-card race and are now within range of Detroit and Seattle in the fight for the AL's final postseason berth.With his image mowed into the grass in center for the final regular-season series of his career, Ortiz hit his 38th homer of the year -- and No. 541 of his career -- to help Boston rally from a 3-1 deficit with four runs in the seventh. It was extra-base hit No. 1,192, tying Ken Griffey Jr. and Rafael Palmeiro for eighth on baseball's all-time list.Dustin Pedroia had three hits for Boston, and Brad Ziegler (2-3) picked up the win with one inning of scoreless relief. Craig Kimbrel pitched the ninth for his 31st save.Devon Travis had three hits, including a pair of doubles, and Jose Batista homered for Toronto.Ortiz singled in the first to give Boston a 1-0 lead, but Toronto went ahead 3-1 in the fifth against Rick Porcello. The major league wins leader failed in his attempt for his 23rd victory, but he avoided the loss when the Red Sox rallied against Joe Biagini (4-3).Andrew Benintendi led off the seventh with a double and Dustin Pedroia dribbled one to the third base side. Josh Donaldson came in on the ball but his throw went past first baseman Justin Smoak; the ball got trapped under the tarp down the right-field line and time was called.Benintendi took off for third, and Pedroia scrambled back to first. Toronto manager John Gibbons came out to argue, but things got worse when the umpires awarded Pedroia second base; after some more arguing, Benintendi was pointed home.One out later, Mookie Betts singled to make it 3-3, and then Brett Cecilcame in to face Ortiz. The crowd, which sat through a 25-minute rain delay to see him honored before the game and play one of his last three regular-season games, rose to its feet chanting "Papi!"After working the count to 2-1, Ortiz lined the ball past the Pesky Pole to send Fenway into one more frenzy. The chants waned before Ortiz popped out of the dugout for a curtain call.Biagini allowed three runs and four hits in 1 1/3 innings.