BOSTON -- Boston's lead in the AL wild-card race was down to 1½ games after losing the opener of a doubleheader, and John Lackey wasn't helping things when he gave up three runs in the first inning of the nightcap.
That's when the Red Sox started hitting, and they didn't stop until they were cruising to an 18-9 victory over the Baltimore Orioles that gave them a split of the day-night doubleheader and stopped, for now, their slide in the AL wild-card race.
"We've been playing from a deficit a lot," said Red Sox manager Terry Francona, whose team has fallen behind by three or more runs in 11 of their last 16 games. "That's a hard way to play."
The Orioles won the opener 6-5 to send Boston to its 12th loss in 15 tries. But Jed Lowrie hit a three-run homer in the first inning to erase an early deficit in the late game and give the Red Sox the lead for good, then Jacoby Ellsbury hit an inside-the-park homer to spark a seven-run seventh inning.
The next five batters reached base before Conor Jackson hit a grand slam as Boston matched its season high in runs and hits (20).
The Red Sox lead Tampa Bay by two games in the wild-card standings. The Rays were idle; they open a four-game series against the first-place New York Yankees on Tuesday.
"We need to have fun," Jackson said. "We've been stressing out. We just need to go out and play baseball like when we were 12 years old and have fun."
Lackey fell behind 3-0, but the Red Sox took a 4-3 lead after one, made it 6-3 in the second and 11-5 after three innings. Then Lackey gave up another run in the fourth and two more in the fifth before Scott Atchison (1-0) came on for a one-pitch double play to end the inning.
"It just got to the point where it's hard to leave him in," Francona said. "We needed to stop the runs, now."
In all, Atchison pitched to three batters and got two double plays, while also dropping a throw covering first for one of Boston's three errors.
Orioles starter Brian Matusz (1-8) got just five outs, allowing six runs and six hits.
Boston slugger Adrian Gonzalez reached base seven straight times in the doubleheader, Marco Scutaro had six hits and Dustin Pedroia drove in five runs on the day. But Lackey couldn't get through the fifth; he has allowed 25 earned runs in 24 2/3 innings in his last five starts, with three losses and two no-decisions.
"That's the best I felt warming up in the bullpen all year. I don't know what ... happened," Lackey said. "I'm glad we won, for sure, obviously. But I'm pretty frustrated. I don't know what to tell you."
The Red Sox essentially clinched it with seven runs in the seventh, the first when Ellsbury hit a long fly ball that bounced off the railing of the Red Sox bullpen wall in right-center and caromed toward left field. Two fielders gave chase, but Ellsbury circled the bases and scored standing up.
"It was tiring," said Ellsbury, who has a career-high 28 homers but had never hit one inside the park before. "I would have rather it went over the wall. But it was exciting."
Jeremy Guthrie (9-17) pitched the last-place Orioles to the win in the day game. Robert Andino and Nolan Reimold hit back-to-back homers into the Green Monster seats off Kyle Weiland (0-3) as the Orioles, who had been outscored 40-20 at Fenway Park this year, won in Boston for the first time in six games.
The Red Sox winnowed a four-run deficit to 6-4 in the fifth inning and appeared to score another, but David Ortiz's liner down the right-field line was ruled foul by first-base umpire Mike Estabrook.
Replays showed it caromed off the lower part of a short wall in fair territory near the Pesky Pole.
"That's the breaks of the game," Pedroia said. "We've played a hundred-something games. We're not going to say the season's over because an umpire missed a call."
Boston, which lost three of four games against Tampa Bay last weekend, led the Rays by nine on Sept 3. The Red Sox have dropped 15 of 20 since they held a 1½-game edge over New York atop the AL East on Aug. 30.
The Red Sox have six games remaining against Baltimore and three in New York against the Yankees. The Rays have 10 to play, seven of them against the Yankees.
"I know Tampa Bay's excited about it," Orioles manager Buck Showalter said. "When it was 11-9, I thought we had a chance. You knew they were going to respond there. We just couldn't stem the tide in the bullpen."
Showalter said he wasn't ready to put INF Mark Reynolds back in the lineup after he missed Sunday's game. Reynolds was hit in the helmet by a pitch on Saturday. ... Francona said OF J.D. Drew may see a doctor soon to check the "stability" of a broken middle finger. Drew has been sidelined since July 20 with a left shoulder injury and broke his finger on a rehab assignment. ... The first game was a makeup of a May 17 rainout. ... Gonzalez went 0 for 12 in the Tampa Bay series and made outs in his first two at-bats Monday before reaching on a double, four singles and two walks.