RICHMOND, Va. – The Portland Sea Dogs put themselves in position to win on two occasions in Sunday afternoon’s game against the Richmond Flying Squirrels.

But the Squirrels celebrated at the end in front of 8,017 fans, rallying for two runs in the bottom of the 10th inning to secure a 5-4 victory.

The Sea Dogs led 3-2 after seven innings and 4-3 entering the bottom of the 10th. That’s when a Russ Mitchell single drove in the tying run, and Juan Perez followed with an RBI single to right-center.

Portland’s offense had been struggling, with a .168 average and one home run in the first five games of a six-game road trip. It showed some life Sunday.

With the Sea Dogs trailing 2-0 in the fourth inning, Juan Carlos Linares led off with a single to left field, and Bryce Brentz followed with a two-run homer over the 330-foot sign in left field.

The Sea Dogs (28-40) took a 3-2 lead in the sixth when Linares launched a leadoff homer over the left-field wall. It was the eighth homer of the season for Linares, who is hitting .343.

Linares (3 for 4 with a walk) and Brentz (2 for 4 with a sacrifice fly and three RBI) accounted for five of the Sea Dogs’ 10 hits. Matt Spring went 2 for 4 to extend his season-high hitting streak to eight games.

“Linares and Brentz both had a quality approach at the plate today,” Portland Manager Kevin Boles said. “They got pitches they could drive. Our offense did what it was supposed to do. We also executed our small game late very well.”

Oscar Tejeda led off the 10th with a sharp single to left off Edwin Quirarte (2-0). He was sacrificed to second by Marquez Smith, and Linares was walked intentionally. Both runners advanced on a passed ball, and Brentz drove in the go-ahead run with a sacrifice fly to left.

But the Squirrels (34-35) fought back against Sea Dogs reliever Aaron Kurcz (2-3). After striking out Gary Brown, Kurcz walked Nick Liles. Daniel Mayora then flew out to right, but the Squirrels got consecutive singles by Tommy Joseph, Mitchell and Perez.

The loss spoiled a strong performance from Sea Dogs starter Stolmy Pimentel, who allowed five hits and two runs in seven innings.

“Pimentel showed very well,” Boles said of the 6-foot-4, 225-pounder who struck out three and threw in the mid-90s most of the game. “He lost his command a little bit, but he showed very well. It was a good start.”

Pimentel gave up an RBI single to Mayora in the third inning, and another run scored on a wild pitch for a 2-0 Squirrels lead.

Pimentel worked out of jam in the fifth. Leadoff hitter Brown drew a one-out walk, then stole second and third. After Liles walked, Mayora hit a grounder to third baseman Smith, who threw out Brown at home. Tommy Joseph grounded out to end the inning.

With Brock Huntzinger trying to protect a 3-2 lead in the eighth, Mayora hit a one-out single. Tommy Joseph fouled out to left, but Mayora stole second and scored on Mitchell’s double to the gap in left-center.