The Angels parlayed a fielding error by Houston pitcher Dallas Keuchel into three unearned runs in the second inning and went on to beat the AL West-leading Astros 3-0 on Friday night, reducing their deficit to 4 1-2 games.

Jered Weaver (7-10) allowed two runs and five hits in six innings, struck out seven and walked two en route to his 138th career victory, which tied Nolan Ryan for second place on the Angels’ career list behind Chuck Finley’s 165.

The last time Weaver faced Houston, he beat them 2-0 with a complete-game six-hitter on May 8 at the “Big A.”

The Astros closed to 3-2 in the sixth on Carlos Gomez’s fourth homer, a towering drive to left-center after Weaver walked Carlos Correa with one out and got behind Gomez 2-0. Weaver struck out the next two batters before manager Mike Scioscia went to the bullpen.

Fernando Salas and Joe Smith each pitched a hitless inning and Huston Street retired the side in order in the ninth for his 34th save in 38 attempts. The Angels remained three games behind Texas and two behind Minnesota in the race for the second wild card spot.