JOHANNESBURG, Aug 3 (Reuters) - The South African rand gave up gains on Wednesday after the dollar recovered on a surprise pick up in the U.S. service sector in July, supporting views that the U.S. economy was not in recession.

The Institute for Supply Management said its non-manufacturing PMI rebounded to a reading of 56.7 last month from 55.3 in June, ending three straight monthly declines.

The latest data erased gains made by the rand in the morning session after China's response to U.S. House Speaker Nancy Pelosi's visit to Taiwan was not as severe as some in financial markets had feared.

Pelosi's visit has caused an increase in tensions between the United States and China, which views Taiwan as a breakaway province, triggering a sell-off in risk-sensitive currencies like the rand on Tuesday.

At 1520 GMT, the South African currency traded at 16.8575 to the dollar, about 0.12% weaker than its previous close.

The dollar index, which tracks the currency against six major rivals, was up 0.28% at 106.74.

Separately, in a relatively light week for domestic economic data, a purchasing managers' index survey showed South African private sector activity expanded for the third month in a row in July.

Stocks on the Johannesburg Stock Exchange (JSE) ended slightly higher, helped by market heavyweights Naspers Ltd and Prosus NV, which ended up 4.14% and 3.73% respectively.

Overall on the JSE, the benchmark all-share index closed 0.89% higher at 68,611 points, while the blue-chip index of top 40 companies ended 0.99% higher at 62,199 points.

The South African government's benchmark 2030 bond was weaker, with the yield up 5 basis points to 10.350%. (Reporting by Alexander Winning and Bhargav Acharya Editing by Mark Potter, William Maclean)