ANAHEIM, Calif. (AP) — The Los Angeles Angels made nine pitching changes, including seven in a four-inning span. Those pitchers grinded and fought and managed to keep the mighty Astros scoreless when they loaded the bases three times in the final five innings.

The Angels refused to play like a team with nothing to play for, and that's why Houston's celebration of the AL's best record has to wait at least another day.

Kaleb Cowart scored when Kyle Tucker made an error on Andrelton Simmons' two-out grounder in the 12th inning, and the Angels prevented the Astros from clinching homefield advantage throughout the AL playoffs with a 4-3 victory Thursday night.

Cowart drew a walk from Joe Biagini (3-2) leading off the 12th for Los Angeles, and he eventually reached third on a groundout. Tucker then failed to handle Simmons' hot grounder to first, ending the Angels' fourth walkoff win of the season.

When asked about his plan for his final at-bat, Simmons replied: "Send everybody home."

"Everybody did a fantastic job," he added. "We're looking to finish strong. We've got to look forward for next year, so everybody has got to do their job and we've got to finish on a high note."

Josh Reddick tied his career high with his fifth hit in the 12th for the Astros, who stranded a season-high 17 runners while losing for only the second time in 11 games.

Despite the loss, the Astros (104-55) are two games ahead of the Yankees (102-57), who didn't play, for the AL's best record. Houston won four of seven over New York during the regular season to claim the tiebreaker.

The Astros are only one game ahead of the Dodgers (103-56), who have clinched the NL's best record. Houston beat Los Angeles to win the 2017 World Series to claim its first championship, winning Game 7 on the road. If the Astros and Dodgers finish with the same regular-season record and meet in the World Series again, Houston would host Game 1 by virtue of its superior intradivisional record.

Trevor Cahill (4-9), the Angels' $9 million ninth reliever, struck out Jake Marisnick to end the 12th, earning his first victory since July 2.

Kevan Smith had an early two-run double for the Angels, who used 10 pitchers for only the third time in club history and the second time this season.

Jack Mayfield hit a tying two-run homer and Tucker also homered for Houston, which fielded a lineup consisting mostly of backups to open their final series of the regular season. The Astros homered in their 22nd straight game, but stranded 12 runners in the final six innings alone.

"Especially in a one-run game, that's a lot," manager A.J. Hinch said of the 17 total runners left on. "We had our chances. A lot of at-bats, contact even to the outfield would have been good for us. Couldn't come up with the big swing, or even the small swing to get someone across. They did at the end."

The Astros loaded the bases with one out in the eighth, but pinch-hitter George Springer grounded into a double play. Houston loaded the bases with one out again in the 11th, but Tucker struck out and Aledmys Diaz grounded into a forceout.

Jaime Barria yielded four hits and three runs in the final start of his second big league season for the Angels before leaving with a blister on his right toe in the fifth inning.

"For the most part, I feel good about the season," said Barria, who finished 4-10 with a 6.42 ERA.

STARTING ARGUMENT

Wade Miley yielded five hits and three runs in four innings for the Astros. The left-hander managed to get more than three outs for only the second time in five starts this September, but it was still another up-and-down effort in his bid to earn Hinch's trust for a postseason rotation spot.

"There were a lot more positives than I've been getting," Miley said. "I never lost confidence. I just went through a little struggle."

Hinch was asked what Miley's effort meant for his postseason role.

"We have a long time before we have to make any sort of decision," Hinch said. "So after a walk-off loss, it's not going to be a time where I assess anything."

EARLY HOMER, LATE BLOOMER

José Altuve got the day off to rest, and his replacement at shortstop came through in the fifth: Mayfield hit a two-run shot for the second homer of his late-blooming career. The 28-year-old infielder made his big league debut in May after six seasons in the minors.

TRAINER'S ROOM

Astros: SS Carlos Correa will sit out the final four games of the regular season to rest his stiff back, but Hinch is hopeful he will be ready for the division series. Correa also sat out Tuesday and Wednesday.

Angels: All-Star selection Tommy La Stella will return from his broken leg to be the Halos' designated hitter on Friday, manager Brad Ausmus said. La Stella's breakthrough season was interrupted by the injury in July, right before he could appear in his first All-Star Game. ... Brian Goodwin left in the second inning with a back spasm after an awkward headfirst slide into second base.

UP NEXT

Houston rookie Jose Urquidy (1-1, 4.63 ERA) makes his case for a postseason rotation spot when he faces Angels rookie Patrick Sandoval (0-3, 5.25 ERA), who is down to his final chance to earn his first major league victory in his hometown ballpark.

More From 1460 ESPN