Amid the disturbances late Tuesday, police detained some migrants and deported them as far as the Libyan border more than 300 kilometres (over 200 miles) away, according to a local rights group.
The latest unrest started after the funeral of a 41-year-old Tunisian man who was stabbed to death Monday in an altercation between locals and migrants, which led to the arrests of three suspects from Cameroon.
"We are going to avenge his death!" young people were heard chanting at the victim's funeral in video footage published online.
Sfax, the North African country's second-largest city, is a departure point for many migrants hoping to reach EU member Italy by sea, often the island of Lampedusa about 130 kilometres (80 miles) away.
Hundreds of angry residents massed in the streets of Sfax late Tuesday demanding the eviction of all illegal migrants, said an AFP correspondent. Some blockaded streets and set car tyres ablaze.
Videos shared on social media showed police chasing dozens of migrants from their homes to the cheers of city residents, before loading them into police cars.
On the Facebook page of community group Sayeb Trottoir, the medic Lazhar Neji, working in the emergency room of a city hospital, deplored "an inhumane... bloody night that makes you tremble".
He said the hospital had received between 30 and 40 injured migrants, including women and children, and said "some were thrown from terraces, others attacked with swords".
Tunisian authorities on Tuesday deported "a group of 100 migrants" from Sfax towards the Libyan border, said a joint statement by the Tunisian Forum for Economic and Social Rights (FTDES) and more than 20 other non-governmental organisations.
"The group included people of several nationalities... (including) at least 12 children aged between six months and five years," it added.
Some of those removed from Sfax were "beaten", the statement said.
- Fear and 'psychosis' -
Jonathan Tchamou, a Congolese man among a group of migrants, told AFP he was "afraid" to remain in Sfax and was trying to take a train out of the city.
"There is a serious problem in Sfax... We are really afraid of staying here that is why I am trying to leave Sfax at any cost," Tchamou said. "Tunisia was a welcoming country. It is no longer safe."
Tunisia has seen a rise in racially motivated attacks following President Kais Saied's comments in February accusing "hordes" of illegal migrants of bringing violence and alleging a "criminal plot" to change the country's demographic make-up.
With a population of 12 million, Tunisia hosts an estimated 21,000 migrants from other parts of Africa, representing 0.2 percent of the population.
Europe has offered funding to help assist Tunisia's efforts against illegal migration and boost its ailing economy.
Saied on Tuesday visited the interior ministry and stressed that Tunisia "does not accept that anyone who does not respect its laws stays on its territory, or uses it as a transit country or to resettle nationals of certain African countries".
Tunisia's violence is once more spreading fear and "psychosis" among migrants, said Franck Yotedje, director of the Afrique Intelligence group, in a Facebook comment, urging the Tunisian state to fulfil its duty to "ensure the safety of the residents of Sfax, Tunisians and foreigners".
- 'Radical solution' -
In the Sfax unrest, dozens of migrants rushed to the railway station to take trains to other Tunisian cities, said an AFP photographer.
Other online footage showed migrants lying on the ground, their hands on their heads, surrounded by residents armed with sticks who waited for police to arrive to hand them over.
Police took some migrants to the site of the Sfax International Fair, from where they were to be transferred elsewhere, said FTDES head Romdane Ben Amor.
The Sfax branch of the powerful UGTT trade union accused the government of having aggravated illegal immigration "by playing the role of the Mediterranean policeman, intercepting the boats of illegal sub-Saharan African migrants and transporting them to Sfax".
It called on Saied's government to "find a radical solution" to the presence of "thousands of illegal sub-Saharan migrants", and said the Sfax region must not be "transformed into a place of assembly or resettlement for these migrants in a desire to please Italy and Europe".