Washington has ramped up pressure on Tehran in recent days, accusing Iran of planning unspecified "imminent" attacks in the region, and bolstering the American military presence in the Gulf.
A State Department advisory announcing the partial embassy closures warned of numerous "terrorist and insurgent groups" active in Iraq, including "anti-US sectarian militias" who could "threaten US citizens and Western companies throughout Iraq."
The US last year shut its consulate in the protest-hit southern Iraqi city of Basra, blaming "indirect fire" by Iran-backed forces.
Tensions have sharply escalated between arch-rivals Washington and Tehran since US President Donald Trump withdrew last May from the 2015 international Iran nuclear deal which removed sanctions in exchange for curbs on Iran's nuclear program.
US Secretary of State Mike Pompeo -- who has made rolling back Iranian influence in the region a top priority -- last week paid a surprise trip to Baghdad in a move to bolster ties with Iraq.
He has declined to go into further detail on the alleged plot, which has been met with skepticism in numerous quarters, including from Democratic lawmakers who fear Trump's administration is seeking to spark a war with Iran.
A State Department spokesman on Wednesday told AFP the departure of non-emergency personnel came in response to "the increased threat stream we are seeing in Iraq."
The Pentagon has said its deployments were "in response to indications of heightened Iranian readiness to conduct offensive operations against US forces and our interests".
But Russia, a major backer of Tehran which has blamed the current crisis on Washington's decision to pull out of the Iran nuclear deal, expressed concern Wednesday that tensions keep escalating despite assurances from Pompeo.
"So far we notice the continued escalation of tensions around this subject," Kremlin spokesman Dmitry Peskov said, a day after Pompeo met with President Vladimir Putin.
"We are saddened to see the decisions taken by the Iranian side," Peskov said, while arguing that Washington has been provoking Iran.
Ruled by Shiite clerics, Iran has a strong influence in Iraq, especially in the country's Shiite-majority south.
Pompeo told reporters he had made his trip because Iranian forces are "escalating their activity" and said the threat of attacks was "very specific."
The top US envoy met with Iraqi President Barham Saleh and Prime Minister Adel Abdel Mahdi, and spoke to them "about the importance of Iraq ensuring that it's able to adequately protect Americans in their country."
Diplomatic security is a key priority for the United States.
Blasts involving improvised explosive devices (IEDs) occur in many areas of Iraq, including the capital Baghdad, the advisory warned, adding that normal visa services would be suspended. Arbil is the Iraqi Kurdish regional capital, in northern Iraq.
- 'Unrelenting force' -
National Security Advisor John Bolton warned that Washington would respond with "unrelenting force" to any attack by Tehran, including by its regional allies.
On Sunday, mysterious attacks by unknown assailants against four ships in the region, including two from Saudi Arabia, sent war talk up another notch.
Neither Saudi Arabia nor the UAE, both close allies of the United States, have given details on the exact nature of those attacks.
The Pentagon said last week it was sending several massive, nuclear-capable B-52 bombers to the region in response to indications of an alleged plan by "Iranian and Iranian proxy forces" to attack US forces.
But a British general said Tuesday there had been "no increased threat from Iranian-backed forces in Iraq and Syria."
The comments by Major General Chris Ghika, a British spokesman for Operation Inherent Resolve, the coalition fighting the Islamic State group, drew a sharp retort from US Central Command.
Both Iran's supreme leader Ayatollah Ali Khamenei and Pompeo have this week played down fears that their countries were headed for conflict.
Khamenei told Iranian officials the standoff "is not military because there is not going to be any war."
Pompeo told Russian officials in the Black Sea resort of Sochi that the US "fundamentally do not seek a war with Iran."
Playing down the statements by Washington's top diplomat, Kremlin spokesman Peskov told reporters: "There were no assurances from Pompeo," and "there is an obvious situation which unfortunately tends to escalate further."