Lackey (4-5) broke a personal three-start winless streak, yielding seven hits and a walk while striking out four.
After spotting the Orioles a 2-0 lead, the Bosox responded when Mike Carp hit a two-run homer in the fourth to tie it.
Baltimore's Matt Wieters socked a two-run homer in ninth against Andrew Bailey, but he held on for his eighth save as the American League East-leading Red Sox took a victory after dropping the first two contests in their four-game series.
Freddy Garcia (3-4) was hung with the loss, surrendering five runs on eight hits over 5 1/3 frames.
Celebrity Families of 2014 [PHOTOS]