The Cubs, with a 42-52 record, are fourth in the National League Central Division, 10-1/2 games behind leaders St. Louis.
"I couldn't be more appreciative of the Cubs organization for providing me the opportunity to manage this ball club," the 66-year-old Piniella said in a statement.
"I've had four wonderful years here that I wouldn't trade for anything in the world.
"I've grown to love the city and the fans but at my age it will be time to enter a new phase in my life.
"It will enable me to spend more valuable time with my family," he added.
Piniella has been under fire to turn around the fortunes of the Cubs, who opened the year with a $140 million payroll.
"Let me make one thing perfectly clear -- our work is far from over," he said. "I want to keep the momentum going more than anything else and win as many games as we can to get back in this pennant race.
"I'm going to give every effort I have to help this team win and that will remain my sole focus through the rest of the season."
Piniella has 1,826 wins in 23 major league seasons as a manager with the New York Yankees, Cincinnati, Seattle, Tampa Bay and the Cubs.
He was Manager of the Year three times, including in 2008 with the Cubs.
"Announcing my decision now is what's best for this organization in the long run," he said. "It gives (general manager) Jim Hendry ample time to find the next manager and he doesn't need to do so in secrecy.
"The Cubs are one of the greatest organizations in baseball.
"I care very deeply for this organization and want nothing more than for it to experience present and long-term success.
"I'm proud of our accomplishments during my time here and this will be a perfect way for me to end my career."
(Writing by Steve Ginsburg in Washington; Editing by Ken Ferris.)