TORONTO — Justin Smoak didn't want Saturday afternoon's game to stretch into Saturday night.

So the Blue Jays first baseman ended it as soon as he could.

Smoak led off the bottom of the ninth with a solo home run, lifting Toronto to a 4-3 comeback victory over the Detroit Tigers.

"Honestly nobody wants to play extra innings so to be able to do it in the ninth, get it over with, it's always a good feeling," Smoak said with a laugh.

Smoak sent a 1-0 fastball from Joe Jimenez (3-1) to the right-field seats, sending the 27,066 fans into a frenzy under a closed roof at Rogers Centre. The stadium's retractable dome remained shut for the game due to an extreme heat warning in place for Toronto, where the temperature reached 31 degrees C.

The walk-off homer was the second of Smoak's career and first since 2016. And it came at a time when Smoak seems to be finding his groove again at the plate after batting .197 over his last 22 games.

"June hadn't been great to me but honestly it's just about being ready to hit again," Smoak said. "I feel like I went through a time there where I wasn't aggressive and kind of got me in that little bit of a funk. So I'm just trying to be aggressive and it's been better as of late."

Manager John Gibbons said it was "a matter of time" before Smoak returned to form.

"We put him down in the fifth spot (of the batting order) and he's kind of taken off," Gibbons said. "Not that that has anything to do with it, it's just the timing probably."

Randal Grichuk, on the other hand, capped a hot June streak with a two-run homer for the Blue Jays (39-43), tying the game in the fifth.

Devon Travis drove in Toronto's first run earlier in the inning, plating Kevin Pillar on a groundout.

Grichuk, who joined the Blue Jays via an off-season trade, came into the game batting .316 with seven homers and 18 RBI's since June 3. The Jays right-fielder had a rough start to the season and missed all of May with a knee strain.

He came off the disabled list on June 1 and has improved in virtually every aspect of his game since then.

"He's laying off the bad breaking balls," Gibbons said of Grichuk's turnaround. "Early on he was just free swinging too much and chasing those all the time ... But I think he put too much added pressure on himself, naturally (when) you come to a new town to play in.

"But yeah he's feeling really good now. That just goes to show you how much confidence plays a part in his game."

Jays reliever Seunghwan Oh (4-2) pitched the top of the ninth for the win.

Sam Gaviglio went seven strong innings for Toronto, allowing three runs and four hits. He also walked three batters and struck out five.

Former Toronto prospect Matt Boyd started for Detroit and allowed three runs, four hits and two walks while striking out seven over six innings.

Boyd was selected by the Blue Jays in the sixth round of the 2013 MLB draft and was traded to Detroit in 2015 as part of the deal that sent ace David Price to Toronto.

He's also a former college teammate of Gaviglio's at Oregon State.

"We had some text messages exchanged," Gaviglio said when asked about facing Boyd. "We talked about getting dinner after the game as well."

John Hicks hit a solo homer for the Tigers (36-48) in the second inning and Nicholas Castellanos added a two-run shot in the third.

The Blue Jays have won 10 of their last 11 home games following a 1-10 stretch at Rogers Centre.

"I feel like we have a pretty good team," Smoak said. "It's just a matter of going out there and winning ball games, it's been good as of late. I wish we could have gotten to Boyd a little better. He was good against us today."

NOTES: Blue Jays catcher Luke Maile threw out two Detroit base stealers. ... Boyd started two games for Jays in 2015, pitching to a 14.85 earned-run average over 6 2/3 innings, before being traded. ... Toronto continues its four-game home series against the Tigers Sunday afternoon. J.A. Happ will start for the Blue Jays while Detroit counters with Jordan Zimmerman.