TORONTO -- Anthony Alford tried to stay cool.
He was just too excited.
"I was trying to hold my smile as best I could but it was pretty tough," said Alford, who made his big league debut in 2017. "That's my first ever walk-off so it felt pretty good."
Alford connected against rookie right-hander Ryan Eades (0-1), who was trying to close out a third consecutive scoreless inning.
Jason Adam (3-0) worked one inning for the win.
Toronto won in its final at-bat for the eighth time, while the Orioles lost in its opponent's final at-bat for the ninth time.
"Another tough loss," manager Brandon Hyde said. "We've had our fair share and then some."
According to STATS, Alford is just the second rookie to make his first career homer a game-ending shot in the 15th inning or later. The first was Valmy Thomas for San Francisco in a win over the Los Angeles Dodgers in May 1959.
Alford said he wasn't thinking about securing the ball from his first homer. He was just happy to end a game that lasted 5 hours, 21 minutes, Toronto's longest in more than a year.
"I'm just excited to get up out of here," Alford said.
Toronto scored twice in the ninth against Shawn Armstrong, tying it at 9. Cavan Biggio hit a sacrifice fly and Vladimir Guerrero Jr. drove in pinch-runner Alford with an RBI single, sending it to extra innings.
The Orioles have homered in 17 consecutive games. It's the second-longest active streak in the majors, according to STATS.
Each team used 10 pitchers.
Hays hit a three-run shot in the third and went back-to-back with Villar in the fifth for the first multihomer game of his career. Hays struck out four times but also made a fine catch in center field and threw out a runner on the bases.
"That's a really tough loss for us," Hays said. "We tried as hard as we could to push a couple more runs across for our staff there at the end but couldn't get another one in."
Last week in Baltimore, Hays climbed the wall in center to take a home run away from Guerrero.
Toronto's Randal Grichuk hit a three-run shot in the first before Brandon Drury and Jonathan Davis went back-to-back in the second, putting the Blue Jays up 5-0. All three homers came off Chandler Shepherd.
The Blue Jays have hit 14 sets of back-to-back home runs, a team record. Toronto's next highest total was 11 in 1999.
Ruiz gave Baltimore a 7-6 lead with his two-run drive off Justin Shafer in the fifth, but Biggio tied it with a two-out drive in the seventh.
Making his fourth career appearance and second start, Shepherd allowed six runs and six hits in three innings.
Blue Jays right-hander Clay Buchholz allowed six runs and six hits, including three home runs, in four-plus innings. He hadn't allowed three homers in a game since May 26, 2016, against Colorado.
Buchholz is 0-2 with a 10.19 ERA in four September outings, including two against the Orioles.
Blue Jays outfielder Lourdes Gurriel Jr. was scratched from the starting lineup and replaced by Jonathan Davis. Gurriel underwent surgery following the game to remove his appendix and will miss the remainder of the season, manager Charlie Montoyo said.
Davis has 21 career homers in 69 games at Rogers Centre, his highest total at any road ballpark.
LATE NIGHT VIEWING
Alford, who is from Columbia, Mississippi, wasn't sure whether his family stayed awake past midnight to see his big swing.
"My mom is probably really excited, if she was up this late watching the game," he joked.
Blue Jays: SS Bo Bichette (concussion) missed his fourth straight game. Bichette left last Thursday's game at Baltimore after being hit on the helmet by a pitch.
Orioles: RHP Dylan Bundy (6-14, 4.89 ERA) has won just once in his past 10 starts but is 1-0 with a 2.12 ERA in three starts against Toronto this season.
Blue Jays: LHP Anthony Kay (1-0, 5.79 ERA) pitched four innings of relief to beat Baltimore on Sept. 19 for his first major league win.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Giants to exclude Aubrey Huff from 2010 World Series reunion, citing 'unacceptable' tweets
The San Francisco Giants said Monday that they won't invite Aubrey Huff to a reunion of the 2010 World Series-winning team later this summer because of "unacceptable" comments made by Huff on social media.
Utilityman Brock Holt reaches deal with Brewers, source says
Utilityman Brock Holt has agreed to a deal with the Milwaukee Brewers, a source told ESPN's Jeff Passan, confirming a report by The Athletic.
Disciplining Astros not as easy for MLB as Altuve revealing a tattoo
As outrage over the sign-stealing scandal burns baseball, how limited were options for punishing Houston's players?
Players have been warned not to plunk Astros hitters
Tim Kurkjian predicts what we'll see this season as Rob Manfred has warned against on-field retribution vs. the Astros.
Sportsbooks expect Astros hitters to be targeted often this season
In the wake of players and managers expressing outrage over Houston's sign-stealing scandal, sportsbook William Hill on Monday set the over/under on number of Astros batters getting hit this season at 83.5.
Francisco Lindor on trade rumors: 'I wanna win' in Cleveland
Despite questions about whether the Indians will want to pay the star shortstop when he hits free agency in two seasons, Francisco Lindor maintained that Cleveland is home for him.