Do you gain XP based on your “level” or your XP total?

Let’s say a 3rd-level character with 5900 XP (100 away from reaching 4th level) clears two EL 5 encounters during an adventure. The PHB says on page 58 that XP is handed out at the end of each adventure, so this means they were in both of these encounters while they were 3rd level.

According to the table on page 38 of the DMG, a party of four 3rd-level characters gains 450 XP per character from an EL 5 encounter, whereas a party of four 4th-level characters gains 400 XP per character.

So, at the end of the above example, would the character have gained 900 XP (they were treated as a 3rd level character during the second encounter, because at the time of the encounter they had 3 HDs and the class features of a 3rd-level character, etc.) or 850 XP (they were treated as 4th level during the second encounter, because at the time of the encounter they had between 6000 and 9999 XP)?