The Bowie Baysox scored three unearned runs in the eighth inning to beat the Portland Sea Dogs 5-3 Friday night before a sellout crowd at Hadlock Field.

Down 3-2 in the eighth, Bowie loaded the bases against reliever Simon Mercedes (1-1), with the help of a fielding error by shortstop Marco Hernandez. With one out, Glynn Davis’ sacrifice fly scored the tying run. With two outs, Ozzie Martinez singled in two runs.

Until then, it looked like Keury De La Cruz’s three-run home run in the first would hold up for Portland. It was De La Cruz’s third home run of the season.

The Sea Dogs could not score any more, despite two hits apiece from Hernandez, De La Cruz, Luis Martinez and Jose Vinicio. Portland (23-32) left 12 men on base.

Bowie left 10 on base, including seven in the first five innings against Red Sox right-hander Justin Masterson, making a rehab appearance with the Sea Dogs.

Masterson retired his first two batters, but gave up a double to Mike Yastrzemski and an RBI single to Brandon Snyder, who used to play in the Red Sox organization. Bowie got another run in the second, but left the bases loaded.

But then the Baysox (29-25) rallied in the eighth for the lead. Bowie closer Mychal Given pitched a 1-2-3 ninth.

NOTES: Former Sea Dogs right-hander Joe Gunkel, who was traded Wednesday to the Orioles, was assigned to Bowie and will pitch against Portland on Saturday. … Bowie’s Sunday starter, Terry Doyle, is another former Portland pitcher (2013). … Catcher Tim Roberson was placed on the disabled list after an MRI revealed a fracture in his right hand. He will miss three to four weeks.