The US is seeking tougher United Nations sanctions to force an end to Iran's nuclear programme, an issue Beijing prefers to resolve through talks.
"An Iran that is a destabilising force in the region is not in anyone's interest, including China's," Gates told reporters in Beijing.
About 12 per cent of China's oil is sourced in Iran.
"America says Iran getting a nuclear weapon could cause WW3 but I think it's more likely that America would cause WW3 by invading Iran"
Jack, Bangor, UK
Send us your views
Tehran has long maintained that its atomic programme is purely for energy generation and has refused to halt uranium enrichment after two previous UN sanctions resolutions.
Washington believes Iran is trying to produce a nuclear bomb.
Gates said he hoped his visit to China would lead to a long-term dialogue to resolve issues between the two countries over transparency and China's military build-up.
"There are clearly areas of agreement and disagreement," Gates said during talks on Tuesday with Hu.
"Talking about both is good for the relationship, and I think as a result of our conversation we have opportunities to expand the military-to-military relationship."
Hu, via an interpreter, said the talks would "be conducive to deepening trust between us and further development of state-to-state relations."
On Monday, the US and China agreed to set up a military hotline between the two countries aimed at increasing transparency and reducing the risk of accidental conflict.
But they remained at odds over the scope of China's military modernisation and a Chinese test of an anti-satellite weapon earlier this year which Washington has said risk triggering an arms race in space.