* Margin for teapots at best level in two years
* Larger teapots run at full capacity to meet domestic demand
* State-owned refiners ramp up fuel shipments on fresh quotas
* Start-up of two large refineries could end high margins
BEIJING, Nov 16 (Reuters) - Chinese oil refiners are churning out record amounts of fuel in the last quarter of 2017, looking to cash in on the best refining profits in nearly two years after a rally in diesel and gasoline prices.
Officials at five state-owned oil processors said they are refining and shipping as much product as possible after receiving generous export quotas.
That is creating a domestic shortage that China's independent refiners - often called teapots - are rushing to meet, while also raising their output to profit from a hike in state-controlled gasoline and diesel retail prices.
"With major oil companies ramping up exports to use their additional quota, regions such as northeastern provinces showed tightness, giving teapots more space to sell their products domestically," said Gao Jian, an oil analyst with China Sublime Information Group.
Wholesales diesel prices quoted by major independent refiners gained about 600 yuan ($90.40) in the last two weeks to 6,600 yuan ($994.40) a tonne, while gasoline prices rose to 6,300 yuan ($949.20) a tonne, both hitting the highest level in two years, data from Zibo Longzhong Information Group showed.
Four independent refiners in Shandong, with a combined 18 million tonnes of annual crude processing capacity are pushing out as much diesel and gasoline as possible due to strong domestic demand, said officials at the processing plants.
The uptake is resulting in low fuel inventories at the refineries ahead of winter, and they will likely need to keep run rates high to replenish stocks. This tightening has also lifted refining margins.
Profits at the independents to process a tonne of crude rose to 800 yuan ($120.49) a tonne this month, highest since early 2016, data provided by China's Sublime Information Group showed.
For state-owned majors, margins to process Daqing crude touched 710 yuan a tonne, best level in a year, according to data from Zibo Longzhong Information Group.
The higher profits come despite a 40 percent surge in underlying crude prices since July.
With margins higher, China's refiners raised overall crude processing to near record levels in October, with runs rising by 7.4 percent from September to 50.51 million tonnes.
The margins are a turnaround for the independents, who struggled to break even this summer amid a pricing war with major refiners Sinopec and PetroChina.
Sinopec and PetroChina own the five refineries that officials said were pumping up runs to maximize fuel exports.
RUNNING UNTIL THE PARTY ENDS
Chinese refiners are also benefiting from a crackdown on illegal fuel sellers, as well as environmental controls that have hit small chemical plants that sell fuel.
"The environmental campaign shut down many of the smaller chemical plants, which helped lift our sales," said a manager with Shandong Dongming Petrochemicals, one of teapots raising crude runs to profit in the current market.
To cash in on the higher margins as much as possible, some state refiners are buying fuel from private competitors to sell abroad, further draining local fuel inventories.
"Recent buying led by Sinopec's procurement division helped draw stocks of both gasoline and diesel to razor thin," a manager with Shandong Fuhai Industrial Co.
Shandong Fuhai and Shandong Wonfull PetroChemical Group were two of the other teapot refiners bumping up throughput.
The high refinery runs will add to China's crude oil imports, currently on track to top United States' imports this year for the first time on an annual basis.
That trend isn't likely to end, with the independents getting a boost in their 2018 crude import quotas.
The profit party could end soon, though, with refining officials saying margins are under threat from the start-ups at PetroChina's Yunnan refinery and CNOOC's Huizhou refinery.
Still, a manager with a 5 million tonne-per-year private refinery said his plant will try to make the good times last.
"As long as we make good margin, we will churn out products at full speed," said the manager, declining to be named.
($1 = 6.6395 Chinese yuan) (Reporting by Meng Meng and Aizhu Chen, Additional reporting by Florence Tan in SINGAPORE; Editing by Josephine Mason and Tom Hogue)