Costolo will be replaced by co-founder Jack Dorsey on an interim basis.
According to a source familiar with the matter, it was Costolo's decision to leave, and Costolo said he brought it up with the board last year as it began talking about succession planning.
Twitter has had a number of shake-ups in its management. Co-founders Jack Dorsey and Evan Williams both served as CEOs of the company before Costolo, and Costolo has overhauled much of his management team over the past year.
"Unfortunately this news isn't surprising," said Nate Elliott of management consultant Forrester Research. "The bottom line is that Twitter isn't very good right now at serving either its users or its marketers."
Costolo said on a conference call that Twitter will consider both internal and external candidates for its next CEO and that it has the "strongest management team (it's) ever had," which influenced his decision to step down. In a statement earlier he said he was "tremendously proud" of his six years at Twitter.
In an interview with Reuters, Dorsey said he was not thinking "at all" about remaining CEO permanently because the search has just begun but did not rule out the job. He also said he did not anticipate any change in Twitter's strategy or direction. Although he was ousted by management in 2008, Dorsey said that he is now surrounded by a strong executive team and had learned from his experience running Square Inc.
Dorsey said the CEO search has not begun, but he noted the company was looking for a CEO who uses Twitter every day and "loves" the product.
Dorsey continues as CEO of Square. He had served as Twitter's president and CEO from May 2007 to October 2008.
Wall Street reacted positively to the news, as Twitter shares rose to $37.17, up 3.6 percent, after the announcement, meaning investors thought Twitter was worth $900 million more without Costolo than with him.
Costolo will step down on July 1 and will continue to serve on the board, the company said in a regulatory filing.
Anthony Noto, Twitter's chief financial officer, said Costolo did not receive a severance package because he voluntarily stepped down.
Costolo has agreed to cancel all of his remaining unvested equity in Twitter after July 1.
"Twitter has never been great at giving its users reasons to come back. While other social sites have introduced new features and functionality the past few years, Twitter has mostly stood still. The result has been excruciatingly slow user growth," Forrester's Elliott said.
Data firm eMarketer projects that Twitter's monthly user base will grow at 14.1 percent this year, compared to more than 30 percent two years ago.
Twitter owned 1.6 percent of the $50.7 billion U.S. digital advertising market in 2014 compared with 1 percent in 2013, according to eMarketer. That pales in comparison to Facebook, which increased its share from 7.6 percent in 2013 to 10.4 percent the following year.
Twitter's stock has also lagged some of its peers since its closing price after its first day of trading. Since Nov. 7, 2013, it has dropped 20 percent, compared to a 72 percent increase for Facebook, 9 percent increase for Google and 27 percent increase for Yahoo.
Chris Sacca, one of Twitter's earliest investors, posted an 8,500-word manifesto earlier this month calling on the company to better engage its users.
He simultaneously praised the company's strong acquisitions of Periscope and TellApart, but Sacca pointed out that one billion users had tried Twitter and left the service.
In a recent CNBC interview, Sacca said that Twitter would be an "instant fit" for Google if it were to acquire the microblogging service.
In a tweet Thursday, Sacca wrote, "In under five years as CEO, @dickc grew Twitter from a $3b valuation to a $23b valuation. Credit where credit is due."
Twitter reaffirmed its outlook for the second quarter of 2015, expecting revenue of $470 million to $485 million and adjusted earnings before interest, taxes, depreciation and amortization (EBITDA) of $97 million to $102 million.
The company disappointed investors in its first quarter results when it reported that its number of monthly average users was growing at a slower pace than Wall Street's expectations.
© Thomson Reuters 2015