After spotting the Blue Jays an early 2-0 lead, the Orioles came back with two in the third inning to tie it up, then went ahead in the fifth when Nick Markasis singled, Hardy doubled and Adam Jones chased home both with a single.
The O's broke it open in the next frame when Manny Machado collected a leadoff hit and one out later Hardy's fly ball just eluded leaping Toronto left fielder Rajai Davis for a two-run homer.
Matt Wieters also drove in a pair of runs for the wild card-contending Orioles, who clinched their three-game series.
Rookie Steve Johnson (2-0) earned the victory in his second major-league start, holding the Blue Jays to two runs on four hits over six frames.
Toronto's Brandon Morrow (7-5) took the loss, allowing four runs on six hits over 4 2/3 frames.
Edwin Encarnacion belted his 34th homer for the Blue Jays.
Rosie O'Donnell unveils nearly 50-pound weight loss
Putin thinks Obama would save him if he were drowning