* TSX ends up 0.25% at 20,204.87

* Energy rises 0.9% as oil prices climb

* Materials sector gains 0.9%

* Canada Manufacturing PMI dips to 48.8 in June

July 4 (Reuters) - Canada's main stock index rose on Tuesday to its highest closing level in one and a half months as investors weighed China's move to curb exports of chipmaking materials and despite data that showed a deeper contraction in the domestic factory sector.

The Toronto Stock Exchange's S&P/TSX composite index ended up 49.58 points, or 0.25%, at 20,204.87, its highest closing level since May 19. It was the sixth straight day of gains for the index, its longest winning streak since April.

The volume of trading was lighter than usual with Wall Street closed for the July Fourth public holiday.

The S&P Global Canada Manufacturing Purchasing Managers' Index (PMI) dipped to a seasonally adjusted 48.8 in June from 49.0 in May as an uncertain economic outlook weighed on both domestic and foreign demand.

The data could help guide expectations for additional tightening by the Bank of Canada at an interest rate decision next week.

"One would hope that the BoC is seeing a slowdown on the manufacturing side of things, even though on the services side, they're not," said Allan Small, senior investment adviser of the Allan Small Financial Group with iA Private Wealth.

"That is the problem for the BoC ... how much do they increase rates to bring down that stubborn core and services inflation."

The energy sector gained 0.9% as oil climbed 1.7% to $71 a barrel after supply cuts by top exporters Saudi Arabia and Russia.

The materials sector, which includes precious and base metals miners and fertilizer companies, also added 0.9% as gold prices rose and after China decided to restrict exports of two metals widely used in semiconductors and electric vehicles.

Shares of Neo Performance Materials Inc, a company that manufactures advanced industrial metals, gained 5.7% and Avalon Advanced Materials Inc shares jumped 24%. (Reporting by Fergal Smith in Toronto and Shashwat Chauhan in Bengaluru Editing by Alistair Bell and Josie Kao)