Evans got off to a blistering start with two early breaks in the first set but when Sousa began to fight back the deficit was already too much.
British No 3 Evans never took his foot off the gas and should have won the second set but for a lapse in concentration at the death.
If that was bad, the world No 61 let slip a 5-2 lead in the third, losing five games in a row.
However, he kept his second-week hopes alive by storming the fourth to take the match to a decider.
The players were kept waiting at around 8pm while the newly-installed Court 1 roof was closed to ensure the final set could go ahead unhindered.
And Evans was the first to capitalise on the new conditions, breaking for a 2-1 lead.
Sousa struck back instantly to level for 2-2 and got the final break when 5-4 up as Evans put a simple volley into the net – a point which summed up his performance.
Portuguese star Sousa will now go on to face Nadal, who beat Jo-Wilfried Tsonga earlier in the day, in the next round.
“Now I think it is time to rest and enjoy this victory,” Sousa said.
“Rafa is a great player, there are no words to describe him.
“Again I will have the crowd against me and I will try my best.”
Sousa also paid tribute to Evans after their marathon clash.
“It was an unbelievable crowd. The crowd was amazing and I’ve never played in front of a crowd like this,” he added.
“I am very proud and it was a great battle. In the end it could be me or it could be him.
“I have to congratulate Danny because it was a great battle and in the end it was fantastic.
“I tried to be focussed as much as I could. I knew the crowd was with him with him being at home.”