UPDATE 2-Cybersecurity firm Palo Alto beats on record customer additions

(Adds analyst, CEO comments; updates shares)

Aug 31 - Palo Alto Networks Inc reported higher-than-expected quarterly profit and revenue, as it added a record number of customers, sending the cybersecurity firm's shares up about 5 percent after the bell on Thursday.

Demand for the company's cloud-based security services has increased since the WannaCry ransomware cyberattack in mid-May, which infected 300,000 computers in more than 150 countries.

Palo Alto, which has more than 42,500 customers worldwide, said it added 3,000 new customers in the fourth quarter ended July 31.

"This is, by far, the strongest quarter for new customer adds in our history," Chief Executive Mark McLaughlin said on a post-earnings call.

Services revenue, which includes revenue from contract-based subscriptions, surged 41.5 percent to $296.8 million. The company gets more than half of its revenue from this business.

"Both WannaCry and Petya have something to do with the elevated demand we've seen in the quarter," Oppenheimer analyst Shaul Eyal told Reuters.

Ransomware Petya affected computer systems across Europe in June.

Palo Alto on Thursday forecast current-quarter revenue of $482 million to $492 million. Analysts' on average estimated revenue of $489.7 million, according to Thomson Reuters I/B/E/S.

The company, whose customers include enterprises and government bodies, said it expects first-quarter profit of 67-69 cents per share, ahead of analysts' estimate of 68 cents.

Billings, defined as total revenue plus the change in deferred revenue, rose 17.2 percent to $670.8 million.

However, net loss widened to $38.2 million, or 42 cents per share, in the quarter, from $31.4 million, or 35 cents per share, a year earlier.

On an adjusted basis, Palo Alto earned 92 cents per share.

Revenue rose to $509.1 million from $400.8 million.

Analysts had expected revenue of $487.3 million and profit of 79 cents per share.

The company also said its Chief Financial Officer Steffan Tomlinson planned to retire. Palo Alto said it would initiate a search for his replacement and Tomlinson would remain as CFO until the search is completed. (Reporting by Laharee Chatterjee and Arjun Panchadar; Editing by Martina D'Couto)