But many stragglers remained on Thursday, posing a challenge to authorities.
Security forces from both sides began the process of policing and securing the border, as the mass exodus across the once impervious passage known as "Philadelphi Corridor" began to reverse itself.
As he toured the northernmost area of the border with Egypt on Wednesday, the Palestinian security commander for southern Gaza, Colonel Jamal Kayed, told Aljazeera.net that his forces have started to secure the border, adding that they would allow traffic to flow back in reverse.
"We are going to secure the Palestinian and Egyptian border to prevent anybody from coming or going. People will be allowed back - Egyptians in Gaza back to Egypt, and Palestinians in Egypt back to Gaza."
However, the flux populi continued on Thursday afternoon, with Egyptian and Palestinian security forces unable to assert control and prevent dozens of people from crossing the border.
"We are taking the humanitarian factor into consideration," said Kayed.
"Otherwise we are going to secure the border to prevent everyone, especially the smuggling, because there is some smuggling of drugs going on and we are going to control it and secure it."
Egyptian officials said the process of fully sealing off the border would be a gradual one because of the large number of people left stranded on either side of the crossing.
"The  border guards are still deploying, slowly. Several are there already, but we cannot just suddenly close the border. It will take time," said an Egyptian security official who asked not to be identified.
Under an agreement reached with Israel, Egypt has deployed 750 of its troops to secure the border and prevent the smuggling of weapons.
Many Palestinians were critical of the renewed closure, citing as the real problem the lack of a systemic means of access out of and into the Gaza Strip.
"If they just opened Rafah as an international border with normalis access for Palestinians, then there would be no reason for all of this madness," said one Palestinian woman, angry at word of the re-sealing of the border.
"The reason people are flooding the border is that they aren't allowed through in a normal way, there is no system to allow that kind of access. They have families and they are going to want to cross. The bigger problem is that there is no established procedure to cross the border."
The Rafah border terminal, which Israeli forces have vacated but still control, was shut down indefinitely last week, leaving 1.5 million Palestinians in Gaza stranded.
The unofficial border passages have been their only means to leave or enter Gaza in the meantime.
The once deadly frontline of the intifada became a porous passage after Israeli forces withdrew from the Gaza Strip last week.
"We are taking the humanitarian factor into consideration, otherwise we are going to secure the border to prevent especially the smuggling"
Palestinian security commander
Thousands of Palestinians and Egyptians streamed across the border to visit relatives and friends they had not seen in decades.
The troubled southern Gaza town of Rafah was divided into two parts by a fence - and later an iron wall - under the 1982 peace treaty between and Egypt and Israel, which returned the occupied Sinai Peninsula to Egypt.
Thousands of Palestinian families were separated as a result.
The Israeli withdrawal has given them the brief opportunity to reunite, many for the first time in decades, as they clambered over and through the barriers, overcome with emotion.
"How are you?! How is the family? I missed you all so much," cried one man, Ibrahim Turbani, as he kissed and hugged a cousin from the Palestinian side after 28 years.
The scene was repeated all along the border, with tearful and emotional reunions between mothers and daughters, brothers and cousins.
Some Palestinians simply went as first-time tourists, curious to find out what was outside of the battered Gaza Strip.
"I came to see this other world I heard about. I've never left Gaza in my life. In fact I've barely left my refugee camp, and this was my opportunity to do so," said 20-year-old Sameera Gashlan, a nursing student in a Gaza university and resident of the Nseirat refugee camp in central Gaza.
For many Palestinians, it was a
chance to see the outside world
"I just wanted to be able to tell my neighbour I was in Egypt today," said another Palestinian man, who had come for a visit with his wife and children.
Many Gazans were reunited with their families that they were otherwise unable to visit in years due to Israeli restrictions on travel.
"I'm going to see my mother, who is very ill, in al-Areesh and try and bring her back to Gaza," explained Saleh Areef, who has been unable to leave Gaza since 1999.
"I left Kuwait to come to live in Gaza, but the Israelis froze the family reunion and residency permits after I arrived and I've been a prisoner in my own land ever since."
Badr Safadi, a 40-year-old health administrator in a PA ministry, had not left Gaza in 10 years.
"For the last 10 years I have been a prisoner of the Israeli occupation. This is an opening, and I hope the opening will widen to include the West Bank and Jerusalem. I hope the border will stay open, especially given the problems we face at Rafah crossing."
The Rafah crossing, which Israeli forces have vacated but still control, was shut down indefinitely last week, leaving 1.5 million Palestinians in Gaza stranded.
"I think it's a bad idea if they close the border. In 1967 it was one land, so why separate Rafah again? We should have open borders; we are one people, one nation"
As they streamed through the border and basked in their short-lived happiness, many Egyptians and Palestinians expressed their dismay at the announcement that the border would be closed that evening.
"I think it's a bad idea if they close the border. In 1967 it was one land, so why separate Rafah again? We should have open borders; we are one people, one nation," said one Palestinian.
"It was Israel who separated Rafah to cut ties between the two peoples," said Hani Salim, also known as Abo Mujahid, a leader of the Al-Aqsa Martyrs Brigades. "It was the first time I left Gaza, in fact I could barely move inside Gaza because I was wanted, so this is a glorious day for me."
Nearby, Palestinians herded goats and sheep they had bought for a fraction of the price in the Egyptian town of al-Areesh, after first hauling them over a part of the border fence.
Palestinians in Gaza have been
savouring their freedom
Egyptian visitors to Palestinian Rafah carried back bags of apples - a staple of northern Gaza, but rare and expensive in Egypt, along with woollen blankets and trays of sweets.
"I wish the border would never close - business has never been so good, and people can finally visit their families," said Egyptian shopkeeper Mohamamd Gumbaz.
As he spoke, and as the 6pm deadline for closing the border neared, Egyptian border police began to order Palestinian visitors back to Gaza, threatening to detain those who disobeyed orders.
Despite the intoxicating festivity on the ground, several Israeli drones whirred menacingly overhead the Palestinian side of Rafah.
They monitored the movement along the border, serving an eerie and foreboding reminder that Israeli troops were never far away for residents of this battered town.
"They're never going to leave us alone, they will continue to make our lives miserable, if not with tanks, then with unmanned drones," said one young Rafah resident, whose home had been demolished, and brother killed, during one of the Israeli offensives into the area.