The ministry also said the number of sows declined by 31.9 percent in July, a year after the nation reported its first outbreak of the disease, which is fatal to pigs but does not harm people.
Swine fever has hit the world's top pork-producing nation hard, roiling its vast agribusiness sector and reshaping the global meat trade.
The declines in both pig and sow numbers last month are significantly steeper than in June data, when the pig herd shrank by 25.8 percent and sow numbers fell 26.7 percent.
Industry estimates suggest the herd may have contracted much more, however, with some putting the decline at 50 percent.
The growing shortfall in pigs has pushed China's live hog prices above the 2016 record, with the national average at 23.49 yuan ($3.34) per kg this week. Analysts also expect pork prices to surpass record levels in coming months.