NEW BEDFORD, Mass. — The Keene Swamp Bats scored three runs in the final three innings of Friday’s game, but it wasn’t enough to come back against the New Bedford Bay Sox. The Bats lost the out-of-division game on the road, 5-3.

Keene’s record falls to 23-16, and it remains a half-game behind the North Adams SteepleCats (23-15) for first place in the Northern Division. New Bedford stands at 12-27 and remains in the basement of the Southern Division.

The Bats return home Saturday to host the Martha’s Vineyard Sharks at 6:30 p.m.

The Bay Sox slowly but surely built their lead over Keene, scoring one run each in the second, third and fourth innings, and two in the fifth to build a 5-0 lead. The runs came courtesy of a sacrifice fly to right by Andrew Rapoza in the second, a single to right by Rafe Chaumette in the third, a solo home run by Rapoza in the fourth and a two-run homer by Paul Gozzo in the fifth.

The Bats’ offense finally got its act together in the seventh, starting with a walk to Kevin Welsh, then a double to right by David Bedgood and finally a two-run single by Randall Bednar. Bedgood’s double brought him to 56 hits on the season, tying Andrew Davis’ team record from 2005.

Keene added one more run in the top of the ninth, with an RBI double to right by Will Wagner that drove in Bedgood, but left runners stranded at second and third after a strikeout by Logan Mathieu and a flyout to center by Kyle Ball.

Mathieu — who has mostly played first base this summer — started on the mound for the second time this season, and pitched a season-high five innings, giving up five runs (four earned) on six hits and two walks with three strikeouts.

Cristian Sanchez came on and threw a shutout inning of relief, allowing two walks and striking out one, and Erick Zecha finished the game with two shutout innings, giving up one hit and striking out three.