Zynga Inc. ZNGA, +0.55% swung to another second-quarter loss, despite rising revenue, as costs surged higher.

Shares plunged 34% after hours to $3.33 after the company sharply lowered its adjusted earnings estimates for the year, saying it is seeing a faster decline in existing web games due to a more challenging environment on Facebook Inc. FB, +1.93% and reduced expectations for its "Draw Something" game. As of Wednesday's close, the company's shares were already trading at nearly half their December initial public offering price of $10 a share.

The company now expects earnings of 4 cents to 9 cents a share, with bookings of $1.15 billion to $1.23 billion. In April, Zynga projected a profit of 23 cents to 29 cents, with bookings of $1.43 billion to $1.5 billion.

The San Francisco-based maker of casual games such as "FarmVille" and "Words With Friends" has built most of its success through ties to Facebook and released its results a day before the social-networking giant issues its first earnings report as a public company. Facebook shares were also down after hours, trading 7% lower at $27.30.

Zynga has reported surging revenue, bringing in most of its top line from the Facebook platform. But, since going public in December, it reported losses in all three of its quarters as a public company largely due to compensation costs, though its recorded seven consecutive quarters of profits before then.

As Zynga continues to seek ways to expand its offerings, it also has separated itself more from Facebook. The company has begun offering access to some of its games over its own website, with gamers appearing to respond positively to the move.

This year, Zynga paid about $180 million in cash to acquire OMGPOP, maker of the popular mobile-phone game "Draw Something." The company spent $45.5 million on 15 different acquisitions last year, according to a filing with the U.S. Securities and Exchange Commission.

In the latest quarter, Zynga reported a loss of $22.8 million, or 3 cents a share, compared with a year-earlier profit of $1.4 million, which was roughly break even on a per-share basis. Excluding stock-based compensation costs and other items, per-share earnings dropped to 1 cent from 5 cents.

Revenue grew 19% to $332.5 million, while bookings rose 9.8% to $301.6 million.

Analysts polled by Thomson Reuters expected a profit of 5 cents a share with $344 million of bookings.

Expenses grew 39%, as research and development costs rose 79%.

Subscribe to WSJ: http://online.wsj.com?mod=djnwires