BOSTON — Christian Bergman’s emotions shifted from frustration and anxiety to trying to block out his previous start.

When he got back on the mound, he certainly pitched relaxed.

Bergman rebounded from a rough outing with seven scoreless innings and the Seattle Mariners halted Boston’s season-high six-game winning streak with a 5-0 victory Sunday.

“It’s a little bit of all of that,” Bergman said. “You want to get back out there. That’s the best way to forget about it and stuff like that, get back out there and start making good pitches.”

Bergman (2-2) allowed four hits, walked two and struck out two. He got a lot of help from his infielders when they turned a double play in each of the first four innings.

“He attacked them and had the double-play ball going, which was huge,” Seattle Manager Scott Servais said. “I can’t say enough about the effort he gave us today.”

Bergman was tagged for 14 hits and 10 runs over four innings in his previous start.

Robinson Cano hit a two-run homer and Guillermo Heredia belted a solo shot for the Mariners, who averted a three-game sweep with just their second win in nine games. Seattle was shut out the first two games of the series.

Three relievers completed the five-hitter, with closer Edwin Diaz getting the final three outs despite two errors by infielders.

Seattle finished one off its club record for most double plays turned in a game.

Boston’s Rick Porcello (3-6) gave up 11 hits but only two runs in 6 1/3 innings.

The reigning AL Cy Young Award winner has had trouble making good pitches for extended innings this season.

“It comes down to consistent location,” Red Sox Manager John Farrell said. “Many times, it’s fastballs that are leaking back to the middle of the plate.”

The Mariners moved ahead 1-0 in the fourth when Kyle Seager raced home from third after Porcello bounced a pitch that went over catcher Sandy Leon’s right shoulder and onto the screen behind the plate.

Seager had doubled leading off the inning and advanced on Danny Valencia’s single.

Heredia homered over the Green Monster in the eighth against Heath Hembree and Cano sent his home run into the center-field bleachers an inning later against Fernando Abad.

TRAINER’S ROOM

MARINERS: Right-hander Hisashi Iwakuma, on the disabled list because of right shoulder inflammation, had another bullpen session because he wasn’t happy with one a day earlier.

RED SOX: Farrell said third baseman Pablo Sandoval, out since late April because of a sprained right knee, will stay on his rehab assignment at Triple-A Pawtucket to get his “timing going” with more at-bats.

TOUGH TIMES

Porcello is finding easy outs a lot tougher to get after going 22-4 with a 3.15 ERA last season.

“I mean, quick-pitch outs have not been my strength up to this point,” he said. “With runners on base, obviously, you’ve got to find a way.”

His ERA did drop from 4.35 to 4.21, though, despite all the hits.

NO TROT

Heredia sprinted around the bases after his home run.

“The home run is over with,” he said via third-base coach Manny Acta being his translator. “What else is there to do but run the bases?”

ROSTER MOVES

Seattle sent Saturday’s losing pitcher, right-hander Rob Whalen, to Triple-A Tacoma and brought up right-hander Ryne Harper from the same club.

The Red Sox also made moves with pitchers, promoting right-hander Blaine Boyer from Triple-A Pawtucket to replace Saturday’s winner, Brian Johnson.

Farrell said after the game that the Red Sox decided to keep Boyer up and send right-hander Brandon Workman down to make room for David Price, who will make his season debut Monday in Chicago.

Boyer made his Red Sox debut, retiring the only two batters he faced.