The Orioles increased their major-league leading home run total to 115 with three in the opening three innings against Hiroki Kuroda (7-6). Davis, meanwhile, has six more homers than anyone else in the big leagues after hitting three in the last two games.
His second-inning drive broke Brady Anderson's franchise record for home runs before the All-Star Game. Anderson had 30 in 1996 en route to hitting 50 for the season, a team record that still stands.
The Orioles tagged seven homers in their first three-game sweep of the Yankees since 2005. New York may have eliminated Baltimore from the playoffs last October, but at this point, the Orioles appear to have the upper hand on their injury-riddled rivals.
"I think it's always a statement whenever you sweep anybody," Davis said. "I think it's been big for us. I think it's our first one this year. We've always put emphasis on winning series and making sure we at least win the majority of the games, but when you can get a sweep, especially against a team in the division, it's huge."
Chris Tillman (10-2) gave up two runs and five hits over six innings to win his sixth straight start and reach a career high for wins in a season. The right-hander is 7-0 in eight starts since May 19.
Jim Johnson worked the ninth to earn his 28th save. Baltimore is 6-3 against New York this season, 5-1 at home.
Robinson Cano homered for the Yankees, who have lost five straight -- matching their longest skid of the year -- and 13 of 18. New York dropped into fourth place in the AL East, 6½ games behind division leader Boston.
"There are a lot of things that go on in life that are struggles that you go through, and you have to figure out how to get through them," manager Joe Girardi said. "This is like life. Everything is not going to be easy. You find ways to get through it. I'm not going to get frustrated. I know the effort these guys are putting in. I'm going to stick up for them."
Kuroda went six-plus innings. The three homers he allowed were a season high, after allowing only two homers in his previous four starts.
"He didn't give up a lot of hits but the hits he did they were loud and they were home runs," Girardi said.
The Orioles activated Brian Roberts from the disabled list, where he had languished since April 5 with a right hamstring injury. Batting ninth as Baltimore's designated hitter, Roberts went 1 for 2 with a sacrifice fly in his fourth game of the season.
"If you are going to be out there you want to contribute," he said. "You don't want to be the weak link in the chain and there are some pretty strong links in this chain."
Machado got Baltimore a first-inning run with his first homer since May 5. The Yankees tied it in the second when Brett Gardner drew a bases-loaded walk with two outs, but Tillman avoided further damage by retiring Ichiro Suzuki on a popup.
Davis opened the bottom half with an opposite-field drive to left field, his second career homer against Kuroda in 15 at-bats.
A solo shot by McLouth made it 3-1 in the third, his fourth hit in 24 career at-bats against Kuroda.
Robinson hit his team-leading 17th homer in the sixth, and Roberts made it 4-2 in the seventh with a run-scoring fly ball.
Not long after that, Orioles fans in the crowd of 40,878 celebrated another win over the hated Yankees.
"The atmosphere tonight (shows) our city has fully embraced this team again," Roberts said. "It's great to be a part of it."
Girardi failed in his fifth try to earn managerial victory No. 600. ... Machado went 3 for 4, including his major-league leading 38th double, and now leads the majors with 34 multihit games. ... The Yankees will send Andy Pettitte to the mound Monday night in Minnesota. The left-hander is 10-0 in his last 12 starts against the Twins. ... Baltimore has Monday off before opening a three-game series against the White Sox. ... Suzuki is 1 for 13 lifetime (.077) against Tillman, his lowest batting average against any pitcher (10 AB minimum). ... Baltimore has won five straight at home against New York for the first time since 1983. ... It was Johnson's 100th career save.