The agreement, finalised during a visit by UN envoy Martin Griffiths, comes ahead of peace talks expected to be held in Sweden this week
Yemen's Saudi-backed government and the Houthi rebels have agreed to exchange hundreds of prisoners ahead of planned peace talks in Sweden, sources said on Tuesday.
The deal, struck during a visit by UN envoy Martin Griffiths, covers between 1,500 and 2,000 members of the pro-government forces and between 1,000 and 1,500 rebels, government official Hadi Haig said.
The International Committee of the Red Cross (ICRC) said it "welcomes the agreement between Yemeni parties for the release, transfer and repatriation of conflict-related detainees".
"This is one step in the right direction towards the building of mutual trust among Yemeni communities," spokeswoman Mirella Hodeib told AFP, adding that the ICRC would oversee and facilitate the exchange.
Griffiths had also hoped to reach a deal on reopening Sanaa airport and agreeing to a detente in the critical Yemeni port city of Hodeidah during his visit.
A Saudi-led coalition has been waging a war in Yemen since March 2015 to push back the Houthis and restore to power President Abd Rabbuh Mansour Hadi, who lives in Saudi exile.
The UN hopes to bring the two sides together for peace talks expected to begin as early as Wednesday and the first since 2016.
According to Hadi Haig, the prisoner swap will be implemented after the round of negotiations in Sweden.
On Monday, a UN charter flight evacuated 50 wounded Houthi fighter for treatment in Oman, a key rebel precondition for the talks.
A Houthi delegation flew out of the Yemeni capital on Tuesday accompanied by a UN peace envoy, heading for high-stakes talks in Sweden with the government aimed at ending the country's devastating war.