The Red Sox missed out on a chance to clinch a playoff berth, managing only one run over the game's final 11 innings after David Ortiz hit a two-run homer in the first.
Baltimore loaded the bases with one out in the 12th against Franklin Morales (2-2), who gave himself a chance to get out of the inning by retiring Manny Machado on a foul popup.
Davis, however, singled to center to bring home two runs and boost his RBI total for the year to 134. That tied him with Detroit's Miguel Cabrera for the major league lead.
T.J. McFarland (2-1) put two runners on in the 11th, but escaped the jam and picked up the win. Jim Johnson survived a leadoff single in the 12th to grab his 47th save.
Baltimore moved within a game of Texas for the second wild card berth in the American League. Five teams battling for that second spot are separated by 2 1/2 games.