Naomi Osaka had to withstand a succession of hot shots and a second-set comeback from Maria Timofeeva to advance in three sets to the China Open third round.