Hundreds of fighters and civilians were killed in both battles, which also added thousands more families to the millions already displaced by conflict on either side of the border.
The effective loss of the capital of Iraq's largest province marked one of Baghdad's worst setbacks since it began a nationwide offensive last year to reclaim territory lost to the jihadists in June 2014.
"Anbar operations command has been cleared," Muhannad Haimour, spokesman and adviser to the provincial governor, told AFP.
IS fighters, who already controlled most of the Anbar provincial capital, used a wave of suicide car bombings to take most of the city and raised their black flag over the provincial headquarters.
Also Read
"Daesh has just taken full control of all main security bases," an army lieutenant colonel, who was among the troops that withdrew from the operations command centre, told AFP, using an Arabic acronym for IS.
Fighting took place in several neighbourhoods of Ramadi but reinforcements were too little too late as IS fighters used their momentum to complete their conquest of the city.
But he said that the city had not completely fallen, as fighting continued in some areas.
Prime Minister Haider al-Abadi said had approved sending forces from the Popular Mobilisation units (Hashed al-Shaabi) to try to rescue Ramadi.
The move marks a u-turn from the Sunni province's previous opposition to resorting to the force, an umbrella for many Shiite militias.
"The provincial council of Anbar decided to call on Hashed al-Shaabi which operates under the umbrella of the commander in-chief of the armed forces," Mahdi Saleh al-Numan, the Anbar governor's security adviser, said.
Three days after IS supremo Abu Bakr al-Baghdadi tried to galvanise his troops in a rare audio message, the jihadists were denied a similar victory on the Syrian side of their self-proclaimed "caliphate".