The Boston Red Sox are helping the New York Yankees stage the greatest comeback in American League history.

No team since the 1904 Detroit Tigers has ever been any farther than 6 1/2 games behind on July 4 and come back to win an American League pennant. With the Red Sox having dropped 11 games in their last 14 - and committing 35 errors in the process - the Yankees, who were nine games back on July 4, sat atop the AL east yesterday for the first time this season.

The Red Sox relinquished the lead, they had held since May 24 when they dropped a 2-1 decision to the Cleveland Indians Wednesday night. At the same time, the Yankees defeated the Detroit Tigers, 7-3, for their 17th win in the last 20 games when triples by Lou Piniella and Mickey Rivers keyed a four-run fourth inning against 15-game winner Jack Billingham.

Graig Nettles led off the fourth with a single and scored on Piniella's triple to tie the game, 1-1. Roy White singled home Piniella and one out later, Rivers tripled for another run. Willie Randolph capped the inning with a sacrifice fly.

"We're world champions," said Piniella. "You can't get too excited moving into first place with 17 or 18 games to play.First play is at stake this weekend in New York and we have to be sure we don't fall on our behinds."

Rookie Jim Beattie, who was exiled to the minors during the Yankees' dark days of July, limited the Tigers to three hits over 61-3 innings for his fifth victory. Rich Gossage finished up.

Meanwhile, the Red Sox committed three more errors in their loss to Detroit although the deciding run came in the fifth on a successful squeeze bunt by Tom Veryzer that scored Dan Briggs, who tripled to lead off the inning. The Red Sox managed only seven hits against winner David Clyde (7-10) and reliever Jim Kern, while stranding eight. Brewers 7, Orioles 5

Sal Bando homered and singled twice for three RBI as the third-place Brewers also capitalized on Boston's loss by moving within four games of first place in the AL east. Bando cracked his 17th homer in the first inning to give Brewers a 1-0 lead, and drilled a two-run single to high-light Milwaukee's five-run second. Andy Replogle (9-2) went five innings for the win. Royals 9, A's 1

Hal McRae drove in four runs, including two with his 16th homer to back Dennis Leonard's 17th win and carry the AL West-leading Royals to their ninth victory in the last 12 games. McRae gave Kansas City a 1-0 lead in the third inning with a sacrifice fly and Amos Otis followed with an RBI double. The Royals added three runs in the fifth, two on McRae's homer. McRae also singled in one of four KC runs in the sixth. Rangers 6, Angels 4

Toby Harrah's second two-run homer of the game - with one out in the bottom of the ninth - dealt the Angels their third straight loss and dropped them 3 1/2 games behind Kansas City. Bump Wills singled off reliever Dave Laroche (9-8) in the ninth and Harrah followed with his 10th homer. Bobby Bonds (his 28th) and Juan Beniquez also homered for the Rangers. NATIONAL LEAGUE Phillies 6, Cubs 2

All the Phillies' runs off Chicago starter Ray Burris and three relievers were unearned. The Phillies scored three unearned runs off Burris in the fourth and, after the Cubs had closed the gap to 3-2 in the eighth, Mike Schmidt's 19th homer scored three more runs for the Phillies in the bottom of the inning.

Ruthven retired the first 18 Chicago batters before giving up a leadoff single to Greg Gross in the seventh. The Philadelphia right-hander struck out four batters and walked out. Dodgers 6, Astros 0

Steve Garvey went 4 for 4, Steve Yeager slugged a two-run homer and Rick Monday drove in two runs with a single and a sacrifice fly off loser Ken Forsch (9-6).

Bob Welch (6-3) struck out four and walked none in snapping a personal three-game losing streak. After an infield single by Terry Puhl to lead off the fourth, the rookie right-hander retired the final 17 Astros. Pirates 7, Cardinals 1

Three-run homers by Bill Robinson and Willie Stargell led Pittsburgh over St. Louis. Bert Blyleven (13-9) tossed a five-hitter as the Pirates capitalized on the two homers and a total of 11 walks.

Losing pitcher Pete Falcone (2-7) yielded eight walks in 2 2/3 innings and was tagged for a three-run, third-inning homer by Robinson after a pair of walks. Padres 6, Reds 2

Broderick Perkins' two-run double and Fernando Gonzalez's run-scoring triple keyed a four-run sixth inning as San Diego snapped the Cincinnati Reds' four-game winning streak.

The Padres sent nine men to the plate and collected five hits and a walk off Reds reliever Manny Sarmiento (9-7) to give Bob Owchinko (9-12) his first victory since Aug. 2. Expos 4, Mets 3

Gary Carter hit a two-run homer and rookie Scott Sanderson and Mike Garman combined on an eight-hitter for the win.

Sanderson (2-2) allowed all eight New York hits, striking out eight and issuing two walks before getting relief help from Garman with one out in the ninth.

Mets loser Nino Espinosa (10-14) suffered his first defeat this season against Montreal after three victories. Expinosa gave up a solo home run to Ellis Valentine in the fourth before Carter's shot in the sixth.