ANAHEIM, Calif. -- After the Los Angeles Angels stranded 16 runners through 18 innings -- including nine in scoring position -- Albert Pujols provided the biggest blow with no one on.

Pujols homered leading off the 19th inning, and the Angels outlasted the Boston Red Sox 5-4 on Saturday night in the longest game in the major leagues this season.

Pujols' 514th career homer and 22nd of the season came on a 3-2 pitch from Brandon Workman (1-6). The towering drive disappeared into the seats above the 18-foot wall in right-center.

"I had the opportunity twice to give the team the lead and I didn't come through, but you just need to stay positive all the time and look for a pitch to hit," Pujols said following a 6-hour, 31-minute marathon in which both teams used nine pitchers, and 558 pitches were thrown. "I did, and I put my best swing of the second half on it."

Boston manager John Farrell made a replay challenge, claiming there was fan interference, but the home run stood.

The Angels had run out of relievers, so Matt Shoemaker (10-4) came in and retired all nine batters he faced to get the victory.

The Angels tied the game in both the eighth and 14th innings.

After David Ortiz gave Boston a 4-3 lead in the 14th with a sacrifice fly, the Angels loaded the bases with none out against Junichi Tazawa.

Mike Trout drove in the tying run with a fielder's choice grounder that scored pinch-hitter Chris Iannetta, who opened the inning with a double.

"That tells you something about this ballclub," Pujols said. "We could have easily just say, `Forget it' after David Ortiz's sacrifice fly and just come back tomorrow. But Chris came back a hit a huge double and we ended up tying the game.

"A game like this can hopefully turn things around for us. And if that's the case, it's worth it to play 19 innings."

Clay Buchholz, who gave up seven runs in each of his previous starts and threw a season-high 114 pitches last Sunday against the Yankees, took a 3-2 lead into the eighth. But Trout drove the right-hander's 115th pitch into the seats in right-center with one out for his 26th home run, and just his second in 17 games.

"As hard-fought as we played this game -- as did they -- sometimes extended games can feel like two losses when you come out on the short end," Farrell said. "But I couldn't have been more proud of the way our guys battled through 19 innings."

Five days after beating the Dodgers 5-0 for his first major league shutout, Angels starter Garrett Richards took a no-hitter into the seventh inning before Dustin Pedroia broke it up with a leadoff single. It was the first of three straight hits, followed by two infield errors that helped Boston pull ahead 3-2.

Until then, Richards hadn't allowed an unearned run all season. The 26-year-old right-hander from nearby Riverside was charged with three runs -- one earned -- and three hits in 6 2/3 innings in his first career start against Boston.

TRAINER'S ROOM

Red Sox: Catcher David Ross, who hasn't played since Aug. 1 because of plantar fasciitis in his right foot, appears on course to be activated on Aug. 17 when he is eligible to come off the disabled list.

Angels: reliever Joe Thatcher, who has missed seven games with a sprained left ankle, isn't expected back from the DL until the Angels host Oakland in a pivotal four-game series from Aug. 28-31.