The blue-chip CSI300 index was up 0.82%, with its financial sector sub-index ending 0.01% higher, the consumer staples sector up 3.03%, the real estate index up 0.29% and the healthcare sub-index up 2.04%.
China reported 30 new coronavirus cases on Wednesday, 23 of which were so-called imported cases involving travellers from overseas, up from 11 a day earlier.
The smaller Shenzhen index ended up 1.05% and the start-up board ChiNext Composite index was higher by 0.95%.
The largest percentage gainers in the main Shanghai Composite index were Inner Mongolia Junzheng Energy & Chemical Group Co Ltd, which closed 10.16% higher, followed by Ningbo Construction Co Ltd, gaining 10.1% and Apple Flavor & Fragrance Group Co Ltd, up by 10.05%.
So far this year, the Shanghai stock index lost 6.8% and the CSI300 dropped 6.3%, while China's H-share index listed in Hong Kong was down 13.3%. Shanghai stocks gained 3.41% so far this month.