Baltimore snapped a two-game skid and remained 1 1/2 games behind the New York Yankees in the race for the American League East pennant. New York defeated Minnesota earlier in the day 8-2.
Nate McLouth hit a solo shot for Baltimore in the first, but the Orioles trailed by a run heading into the bottom of the fifth.
Baltimore scored five times in that inning on solo homers by Jim Thome and Machado and a three-run blast by Davis.
Mark Reynolds added a two-run homer in the sixth, Davis had a two-run shot in the seventh and Machado finished things off with another two-run home run in the eighth.
Machado has six homers in his rookie season and this was the first multi-homer game of his career.
Another Baltimore rookie, Miguel Gonzalez, got the win by limiting Toronto to two runs on five hits in seven innings. He improved to 8-4.
The first four homers for the Orioles came off Carlos Villanueva (7-7), who gave up six runs overall in 4 2/3.