The migrants, primarily from sub-Saharan African countries, had been driven to the remote desert area of Ras Jedir by Tunisian authorities and left there to fend for themselves, according to witnesses, rights groups and UN agencies.
Aid groups said three groups of about 300 migrants in total from sub-Saharan African countries remain stranded there in life-threatening conditions.
Since the start of July, "at least 27 migrants" have been found dead after being abandoned in the Tunisian-Libyan border area and another 73 are missing, a humanitarian source told AFP on Thursday.
A spokesman for Tunisia's interior ministry, Faker Bouzghaya, said during a joint meeting with Libyan authorities in Tunis that "we have agreed to share the groups of migrants who are at the border".
"Tunisia will take charge of a group of 76 men, 42 women and eight children," Bouzghaya said.
He said the groups were transferred on Wednesday to reception centres in the cities of Tatouine and Medenine and provided with health and psychological care, with the help of the Tunisian Red Crescent.
Under the agreement, Libya will take in the remaining 150-200 migrants, humanitarian sources said.
The Libyan interior ministry announced the agreement to "put an end to the crisis of irregular migrants stranded in the border area".