Sousa arrived at the season’s final Grand Slam in dreadful form having lost his last seven matches but suddenly found his game on the Flushing Meadows hardcourts knocking off two seeded players, number 12 Pablo Carreno Busta and number 17 Lucas Pouille, on route to the last 16.
The first Portuguese player to reach the fourth round of any Grand Slam, the 68th ranked Sousa never looked a threat to progress any further as his magical US Open run came to an end.
The biggest concern for Djokovic might well have been the conditions as the heat returned to New York after a few days of relief.
Through his opening-round matches Djokovic and his play both suffered under a blazing sun and with temperatures once again nudging into the 30s Celsius, the extreme conditions took a toll on 31-year-old Serb.
The sixth seed went off court two sets and 2-1 up for a medical evaluation.
The 13-time Grand Slam winner had made easy work of the opening set, breaking Sousa twice, the second time to close out the set.
Things grew tougher in the second as a sluggish Djokovic laboured before again clinching the set with a break.
As the temperatures rose, so did the tempers, both players engaging in animated arguments with chair umpire James Keothavong over points.
Djokovic, however, was able to keep his cool just long enough to finish off Sousa with another late break.