Khanal appeared to have had no access to food or water during his ordeal, which began at midday on Saturday when a 7.9 magnitude earthquake hit Nepal, destroying buildings and killing at least 4,600 people.
"It seems he survived by sheer willpower," said Akhilesh Shrestha, a doctor who treated him.
Khanal had been on the second floor of a seven-storey building when the quake struck. The top floors were intact and the teams drilled down to him after he shouted for help and responded to questions in Nepali.
The rescue took five hours. Doctors think he may have a broken leg.
The number of people killed in Nepal by the Himalayan country's worst earthquake in eight decades has risen to 5,006, a home ministry official said on Wednesday.
That number represented a jump of 300 from earlier on Wednesday. Nepal's Prime Minister Sushil Koirala told Reuters on Tuesday the toll from the 7.9 magnitude quake could reach 10,000.