BALTIMORE — The Baltimore Orioles waited a long time to put on a power-display like this one, and they relished every hit.

J.J. Hardy and Chris Davis each hit two of Baltimore's six home runs, Hyun Soo Kim had a career-high four hits and the Orioles beat rookie Joe Musgrove and the skidding Houston Astros 13-5 on Thursday night.

Mark Trumbo and Manny Machado also homered to help the Orioles improve to 40-19 at home and climb into a second-place tie with Boston in the AL East. The 13 runs matched a season high, set June 1 against Boston.

The Orioles had scored three runs or fewer in 20 of 32 games since the All-Star break, so this amounted to a slugfest of major proportions.

"I think there was a lot of frustration there," manager Buck Showalter said. "I don't know if frustration is the right word, but (they wanted to) get back to what we're capable of doing."

Trumbo set the tone in the first inning with his major league-leading 35th home run, a three-run shot to left against Musgrove, who looked every bit like a 23-year-old rookie making his third major league start.

"They're a fastball-hitting team. I like to throw fastballs," the right-hander said. "I didn't locate pitches very well. Got behind."

And, for a change, the Orioles took full advantage.

"Seems like a while now, we weren't getting many mistakes," Showalter said. "And when we were, we weren't as consistent with making them pay as we were tonight."

Musgrove (1-1) gave up eight runs and 11 hits — including three homers — over 5 1/3 innings.

"It was really just pitch execution," manager A.J. Hinch said.

Picked by Toronto in the supplemental first round of the 2011 draft, Musgrove began his big league career with a flourish — allowing only three runs in 19 1/3 innings. But this encounter lifted his ERA from 1.47 to 4.18.

Alex Bregman and A.J. Reed homered for the Astros. They have lost five straight.

After watching his pitching staff yield 12 runs and 17 hits over the first seven innings, Hinch called upon infielder Tyler White to pitch the eighth. White gave up one hit: Davis' second homer of the game, the third in two nights.

"They just continue to come at you," Hinch said. "This how they score. We didn't keep them in the ballpark the entire night."

Kevin Gausman (4-10) struck out eight in 6 2/3 innings for Baltimore, giving up five runs, four earned.

After Trumbo got things started for Baltimore by setting a career high in homers, the Orioles added two runs in the second inning and went up 7-2 in the fourth when Hardy homered with a man on.

Hardy chased Musgrove with another shot in the sixth, and Machado and Davis connected in succession off James Hoyt later in the inning to make it 12-3.

Kim, meanwhile, had three singles and his first career triple. Playing in first year in the majors after a 10-year run in South Korea, the rookie can't help but marvel at his teammates' power.

"I was never with a team that hits this many home runs," he said through an interpreter. "It is very exciting. I feel just great being part of it."

TRAINER'S ROOM

Astros: Luis Valbuena (right hamstring strain) made the trip to Baltimore, and Hinch said the infielder is "inching" toward a rehab assignment. ... The status of RHP Lance McCullers (sprained right elbow) remains unclear until he visits a doctor next week. "It's all guesswork at this point," Hinch said.

Orioles: RHP Chris Tillman (sore shoulder) threw off flat ground and "is ready to go" for his start Saturday against Houston, manager Buck Showalter said.

UP NEXT

Astros: RHP Colin McHugh (7-10, 4.70 ERA) starts in the second game of the series Friday night. He's 0-4 with a 7.65 ERA in his last four starts.

Orioles: LHP Wade Miley (7-10, 5.23) makes his fourth start since being traded from Seattle. The lefty is 0-2 with a 7.04 ERA with the Orioles.