Kacha Garhi camp in the North West Frontier Province was one of four camps UNHCR and Pakistan planned to close this year which Islamabad says have become havens for the Taliban, who are fighting an intensified insurgency in Afghanistan.
Millions of Afghan people either live in refugee camps or work illegally in neighbouring Pakistan and Iran.
"The Kacha Garhi camp was officially closed on July 26 and over 37,000 registered Afghans were assisted back to their country from the camp," UNHCR spokesman Babar Baluch said.
"People went back on a voluntary basis, while some of the Afghan refugees opted for relocation to government-designated camps in Dir."
Dir is a different border district.
Baluch said the Jalozai camp, also in the NWFP near the Afghan border, was scheduled to be closed on August 31. The other two camps -- Jungle Pir Alizai and Girdi Jungle -- are located in southwestern Baluchistan province.
"The peaceful closure of Kacha Garhi camp has set a very good example," a UNHCR statement quoted Faridullah Jan, the Additional Commissioner of the Commissionerate of Afghan Refugees in NWFP, as saying.
Refugees in the camps due to be closed can volunteer to return home or move to another camp in Pakistan.
While the Kacha Garhi camp has been closed peacefully, Pakistani authorities are facing difficulties in vacating the Jungle Pir Alizai camp in Baluchistan, where the UNHCR stopped relief activities in 2005 after it had lost its "humanitarian value", one official said.
Afghans in the camp say they don't want to go home to a country crippled by more than 20 years of war.
Pakistani authorities are confident the refugees will ultimately go home without major problems.
The UNHCR, which is running a voluntary repatriation programme for Afghans, has urged Pakistan to tread carefully, fearful impoverished Afghanistan could be hit by floods of people from both Pakistan and Iran.
More than 4.6 million Afghans have gone home from Pakistan and Iran since the overthrow of the Taliban in 2001. But about 3 million Afghans remain in Pakistan.
The officials say many Afghans have acquired Pakistan's national identity cards and some have mixed in with the native population through marriage. Many Afghans live and run businesses in Pakistani cities and towns across the country.
There are an estimated 2 million refugees in Iran, which recently forced about 100,000 Afghans back home.