Pettitte, 41, previously retired in February 2011, but came back halfway through the 2012 season. He is the winningest all-time postseason pitcher and a shoo-in for the Hall of Fame.
On Sunday, Pettitte will start against the Giants in Yankee Stadium, which would put him on target to make the final start of his career against the Astros in his home Houston.
His retirement is effective at the end of the season.
Read his full statement below:
"I'm announcing my retirement prior to the conclusion of our season because I want all of our fans to know now -- while I'm still wearing this uniform -- how grateful I am for their support throughout my career. I want to have the opportunity to tip my cap to them during these remaining days and thank them for making my time here with the Yankees so special.
"I've reached the point where I know that I've left everything I have out there on that field. The time is right. I've exhausted myself, mentally and physically, and that's exactly how I want to leave this game.
"One of the things I struggled with in making this announcement now was doing anything to take away from Mariano's day on Sunday. It is his day. He means so much to me, and has meant so much to my career that I would just hate to somehow take the attention away from him."
Turkey considering to use pistachios to heat country’s first eco-city
Lytro unveils camera that can focus a photo after shooting it