SHANGHAI—China failed to sell all the government debt it had planned to Friday, in the second incomplete auction in just over a month as rising yields and signs of improving economic growth turn investors away from the safety of bond markets.

The main buyers of Chinese government debt are banks and they have grown increasingly short of cash as a series of mini-stimulus measures by Beijing has pushed them to focus more on lending to companies. That is reducing the funds available in the financial system, cutting demand for low-yielding government bonds and sending China's borrowing costs higher.

Meanwhile, signs that the sluggish Chinese economy is gaining traction have left investors less interested in bonds and worried that prices, which move inversely to yields, may have further to fall. The world's second-biggest economy expanded 7.5% in the second quarter from a year earlier, versus 7.4% in the previous quarter.

"Investors don't have strong demand for the short-term bonds, as liquidity has turned so tight recently," said Gao Yang, a trader with China Guangfa Bank.

At a routine auction Friday, China's Finance Ministry sold 23.4 billion yuan ($3.8 billion) of two-year bonds. It had planned to sell 26 billion yuan. The bonds were sold at an average yield of 3.99%, higher than the 3.79% on bonds of the same maturity that are currently being traded. Yields have risen by around 20 basis points since the start of July.