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."