David Adams hit a two-run double and Mark Reynolds also drove in a run for the Yankees, who stopped a four-game losing streak.
Houston dropped to 51-109, the most losses for a major league team since the 2004 Arizona Diamondbacks went 51-111.
The Astros' 322 losses over three seasons are the fifth-most in big league history according to STATS, ahead of only the 1962-64 New York Mets (340), the 1963-65 Mets (332), the 1915-17 Philadelphia Athletics (324) and the 1940-42 Philadelphia Phillies (323).
A night after Rivera's emotional farewell at Yankee Stadium, New York started the final series of a disappointing season in which the team failed to reach the playoffs for just the second time in 19 years.
Adam Warren (3-2) allowed two hits and struck out four in five scoreless innings. David Phelps gave up Brett Wallace's two-run double in the seventh, got Houston within 3-2 with a two run double in the seventh, and Joba Chamberlain struggled before Preston Clairborne and Robertson closed it out.
Robertson, who got his third save, figures to inherit the closer role Rivera has held since 1997.
Houston starter Brett Oberholtzer (4-5) yielded three runs - two earned - and five hits in 5 1-3 innings.
Robinson Cano singled with one out in the fourth, Alfonso Soriano walked and Reynolds singled to drive in the go-ahead run. Third baseman Matt Dominguez's error allowed Soriano, and Adams doubled just inside the fence in the left-field corner.
Houston struck out seven times, increasing their franchise-record total this season to 1,511. They are 18 shy of Arizona's record, set in 2010.
NOTES: New York's Andy Pettitte will make his final start before retiring on Saturday against Paul Clemens. The 41-year-old Pettitte, who is from nearby Deer Park, played for the Astros from 2004-06. "To be able to make my last start here in my hometown is going to be extremely special," he said. "Everybody that I've grown up with ... and that instilled things in me is going to be here. So it's going to be a really exciting day for me. And it's fitting, I believe." The Astros honored Pettitte in the middle of the fifth inning on Friday night by presenting him with the framed No. 21 jersey he wore when he played in Houston. ... Yankees manager Joe Girardi said Rivera can play center field this weekend if he wants to. The 43-year-old has said he wants to play in the outfield. "I'll talk to him every day to see what he wants to do," Girardi said. "I know he's talked about playing some center field, but I know he has some concerns about his leg. That's really up to him. If he wants to do it, he can do it. I'm OK with it."