* Chinese regulator restricts sale of shares
* Cautious optimism on Greece
* Coty falls after agreeing to buy P&G's beauty business
* Indexes up: Dow 0.25 pct, S&P 0.3 pct, Nasdaq 0.4 pct (Updates to afternoon trade)
By Tanya Agrawal
July 9 (Reuters) - U.S. stocks trimmed earlier strong gains in afternoon trading on Thursday after Wall Street found relief in Beijing's efforts to halt a rout in Chinese stocks, which lifted markets around the world.
Wall Street had fallen sharply in the previous session as market turmoil in China, a rout in commodity prices, the Greek debt crisis and a major outage on the New York Stock Exchange spooked investors.
China's securities regulator, in its most drastic step yet to arrest a selloff on Chinese stock markets, banned shareholders with large stakes in listed firms from selling for the next six months.
About 30 percent has been knocked off the value of Chinese shares since mid-June. Some investors fear that the turmoil in the Chinese market could destabilize the global financial system, making it a bigger risk than the Greek crisis.
Adding to cautious optimism on Wall Street, European markets rose on hopes that Greece might be able to win a deal that could keep it in the euro zone. Greek Prime Minister Alexis Tsipras has until midnight to propose spending-cut plans.
"There a relief that (China's selloff) didn't continue. There's a relief that there doesn't seem to be any belligerent tone coming out of Greece," said Steve Goldman, principal of Goldman Management in Short Hills, New Jersey.
At 2:25 p.m. (1825 GMT) the Dow Jones industrial average was up 44.39 points, or 0.25 percent, at 17,559.81. The S&P 500 was up 6.19 points, or 0.3 percent, at 2,052.87 and the Nasdaq Composite was up 19.75 points, or 0.4 percent, at 4,929.51.
All three indexes earlier traded up 1 percent or more.
Seven of the 10 major S&P 500 sectors were higher, with the financial index leading the gainers with a 0.67 percent rise.
The NYSE, which accounted for about 13 percent of the volume of U.S. stocks traded last month, said Wednesday's halt was due to a technical problem that stemmed from new software rolled out the previous evening.
U.S. second-quarter earnings season is getting under way with major U.S. banks scheduled to report next week.
Shares of Walgreens Boots Alliance, the largest U.S. drug store chain, were up 4.9 percent at $90.17 after the company raised its full-year profit forecast.
Coty's shares fell 5.7 percent to $29.71 after Procter & Gamble agreed to sell its beauty business to the company in a deal that values the business at $12.5 billion. P&G shares were down marginally at $80.87.
In U.S. data, new applications for unemployment benefits rose last week to their highest since February.
Advancing issues outnumbered declining ones on the NYSE by 1,827 to 1,205, for a 1.52-to-1 ratio on the upside; on the Nasdaq, 1,812 issues rose and 905 fell for a 2.00-to-1 ratio favoring advancers.
The benchmark S&P 500 index posted nine new 52-week highs and 13 new lows; the Nasdaq Composite recorded 31 new highs and 59 new lows. (Reporting by Tanya Agrawal; Editing by Saumyadeb Chakrabarty and James Dalgleish)