Gates, who said his visit is aimed at ensuring that Afghanistan's security situation improves, also met with Afghan military leaders during a tour of a military training center on the outskirts of Kabul.
Gates said that despite a rise in insurgent violence in Afghanistan during the spring, he remains convinced that U.S. and NATO forces are making steady progress against the Taliban.
Speaking at a Kabul press conference after talks with Karzai, Gates also corroborated reports that the U.S. military has been discovering Iranian-made weapons in western and southwestern Afghanistan.
When asked about alleged shipments of Iranian weapons destined for the Taliban, Karzai said he is uncertain about the source of such deliveries. But he said the governments in Kabul and Tehran have good relations and that trade between the two countries is good.
Karzai said Iran has contributed millions of dollars to the Afghan economy through aid and trade.
That is the kind of help that Gates has been asking Afghanistan's neighbors to make. Speaking on June 3 at a security conference in Singapore, Gates called on Asian states to provide extra support for Afghanistan.
"I would urge others to step forward with assistance to Afghanistan in the areas of governance, reconstruction, and counternarcotics," Gates said. "It is clear that Afghanistan and its newly independent neighbors in central Asia face steep obstacles as they strive to make the transition into prosperous, secure, and fully sovereign nations."
Afghan Army Woes
Despite Gates' upbeat assessment about the fight against the Taliban in Afghanistan, he was told by the head of the Afghan National Army today that Kabul is not getting enough cooperation from neighboring Pakistan.
Afghan Army Chief of Staff General Bismullah Khan made the remarks to Gates as the two toured Camp Morehead, a military facility center on the outskirts of Kabul where the Afghan National Army's first battalion of commandos is being trained.
Bismullah Khan said Kabul's relationship with Pakistan is "under the coordination of the United States." He also said Islamabad and Kabul need a better exchange of information and more joint training exercises.
Both Pakistan and Afghanistan are allies of the United States in its declared "war on terror."
But relations between the uneasy neighbors have deteriorated in recent months. The worst violence in years erupted in early May in a disputed border area in Afghanistan's southern Paktia Province.
Officials in Kabul say Pakistani government troops invaded Afghanistan's territory and killed 13 Afghans. Pakistan said Afghan troops started unprovoked firing on Pakistani border posts.
The two sides also blame each other for the resurgence of the Taliban.
RFE/RL's Kyrgyz Service reports that Gates is scheduled to leave Afghanistan tonight for a trip to Kyrgyzstan, where will meet on June 5 with President Kurmanbek Bakiev.
The United States maintains a base in Kyrgyzstan to support its continuing operations in Afghanistan.
(RFE/RL's Radio Free Afghanistan Kabul bureau contributed to this report.)