* Air base last foothold of Syrian army in the area
* Islamic State has attacked base for days
* Syrian army regrouping after battles, state TV says (Adds death toll, detail)
By Sylvia Westall
BEIRUT, Aug 24 (Reuters) - Islamic State militants stormed an air base in northeast Syria on Sunday, capturing it from government forces after days of fighting that cost more than 500 lives, a monitoring group said.
The Syrian Observatory for Human Rights said at least 346 Islamic State fighters were killed and more than 170 members of government forces had died since Tuesday in the fight over Tabqa base, making it one of the deadliest confrontations between the two groups since the start of Syria's war.
The Observatory, which monitors violence in Syria through sources on the ground, said fighting raged inside the air base on Sunday. It was the Syrian army's last foothold in an area otherwise controlled by Islamic State, which has seized large areas of Syria and Iraq.
In nearby Raqqa city, an Islamic State stronghold, there was celebratory gunfire and several mosques announced through their loudspeakers that the base had fallen to the Islamists and cheered "God is greatest", a witness told Reuters.
IS fighters displayed the severed heads of Syrian army soldiers in the city square, the witness said, adding that Syrian warplanes were heard over Raqqa following the air base attack. Earlier on Sunday the Syrian air force had bombed areas around the base.
Syrian state television said that after fierce battles, the military was "regrouping".
Citing a military source, it said there was a "successful evacuation of the airport" and that the army was continuing strikes on "terrorist groups" in the area, which it said had suffered heavy losses.
Syrian state media gave no figure for the number of people killed in the clashes.
Islamic State had also trapped around 150 retreating Syrian soldiers in an area near the base and was believed to be holding them captive, the Observatory said.
The Syrian army sent reinforcements to the base overnight on Friday to fight Islamic State, which controls roughly a third of northern and eastern Syria.
Syrian television had shown footage of army forces defending the base on Saturday who had said it was safe from Islamic State's advances. Many of the Islamic State fighters died after Syrian warplanes bombarded the area, the Observatory said.
Islamic State, a radical offshoot of al Qaeda, has taken three Syrian military bases in the area in recent weeks, boosted by arms seized in Iraq.
Syria is calculating that the IS push to reshape the Middle East will eventually force the West to deal with President Bashar al-Assad as the only way to tackle the threat, sources familiar with Syrian government thinking have said.
Elsewhere in Syria, the group withdrew from northern areas it controlled outside the city of Homs on Sunday and retreated east after coming under attack from rival Islamist fighters, the Observatory said.
Fighters from the group withdrew from a headquarters north of Homs on the orders of their leader Abu Bakr al-Baghdadi, the Observatory said, citing sources in the area.
They said IS gave up the territory to Nusra Front, al Qaeda's official wing in Syria.
As well as Nusra Front, Western-backed rebels have also been fighting IS in Syria but have regularly been defeated by the group, which in June declared an "Islamic caliphate" in the territory it controls.
Activists have accused the Syrian army of avoiding confrontations with IS because it has weakened rival rebel groups also battling Assad. (Additional reporting by Tom Perry; Editing by Gareth Jones, Stephen Powell, Lynne O'Donnell and Giles Elgood)
Our Standards: The Thomson Reuters Trust Principles.