BOSTON -- Nelson Cruz was all smiles Saturday night.

A career performance will do that.

So will a failed attempt at the cycle.

Baltimore's left fielder was thrown out at third base while attempting to hit for the cycle, but he still belted his 27th home run of the season as part of a career-high five-hit night that powered the Orioles to a 7-4 win over the Boston Red Sox and salvaged a split of the day-night doubleheader.

"I know I tried one last year and I got thrown out at third, too," Cruz said with a laugh. "That's why I don't try it."

In the first game, pinch hitter Jonathan Herrera drove in the winning run on a broken-bat single in the ninth inning to lead the Red Sox to a 3-2 victory that snapped their three-game losing streak.

In the second game, Cruz ensured there would be no sweep and helped put Baltimore (47-40) back on top in the American League East in the process.

Cruz doubled in the first inning, singled in the third, hit a solo shot in the fifth, singled in the sixth and doubled in the eighth -- but wanted one more base.

When the ball went over the head of right fielder Daniel Nava, Cruz immediately kicked it up a notch, knowing full well he was heading for third.

"As soon as I saw it went over his head, I was like, 'I got to make a shot, see what happens,'" Cruz said.

Nava threw the ball over second baseman Dustin Pedroia's head, but shortstop Stephen Drew was backing him up and nabbed Cruz as he slid head-first into third. It would have been Cruz's first triple since July 1, 2011, while with the Texas Rangers.

"If you can't enjoy that and take it the way you need to, you're taking yourself way too seriously," Baltimore manager Buck Showalter said. "I'm glad they didn't hit the first cutoff guy, so at least it was close. They're all screaming at me to do the replay.

"We tell them all the time, 'You feel something, go for it,'" he added. "Gosh, he had a great night."

Catcher Nick Hundley hit a two-run homer for the Orioles, who won for the fifth time in six games.

Boston starter John Lackey (9-6) allowed five runs on 10 hits in 5 1/3 innings. The right-hander walked one, tied his season high with 11 strikeouts and left the game with two runners on base and a 4-3 lead.

But Burke Badenhop couldn't work out of the jam. Three straight singles, coupled with an error by Nava, put Baltimore back on top 6-4. The Orioles tacked on another when shortstop J.J. Hardy reached on a fielder's choice.

"Honestly, that's about as good of stuff as I've had all year and I'm trying to figure out what happened to give up five runs," Lackey said. "They've got a good lineup. It seemed like every time they touched the ball it was a hit."

Brad Brach (3-0) pitched 1 1/3 innings for the win and Zach Britton recorded his 13th save with a perfect ninth, capping a stretch of 15 straight batters retired by Baltimore's bullpen.

"Bad day and good day," Cruz said. "It started bad and finished good."

Drew hit a two-run homer, his second of the day, for Boston.

Lackey worked out of some early jams before serving up Hundley's second homer of the year, which staked Baltimore to a 2-0 lead in the fourth inning.

Boston answered with four runs in the bottom of the fourth against Orioles starter Ubaldo Jimenez.

Drew tied the score with his second homer of the season -- all in a span of six at-bats Saturday -- before third baseman Brock Holt put Boston in front 3-2 with an RBI double. Nava ended Jimenez's night with a run-scoring single.

Jimenez allowed four runs, five hits and six walks in 3 2/3 innings, his second-shortest start of the season. The right-hander struck out four.

"He was fortunate to give up the few runs that he did," Showalter said. "The stuff is there, but we were fortunate to stay engaged in the game with that many walks."