It happens to me all the time, especially on rhythm games, but also on other action and fighting games where flawless performance is crucial.
I've practiced a very tough level several dozen times, and I'm getting really close to finish it flawlessly (like full combo, or something like that). And then when I start my perfect run push, as I get closer to finishing the level, at the very end I choke and I end up doing some stupid mistake I wouldn't do otherwise. I can't say how many times I've seen a result screen like this:
On the other hand, if I make a mistake early on the level, I know I'm not going to finish it perfectly, so I can flawlessly clear the later part of the level.
I think it has something to do with unconscious movement. If I'm doing the level unconsciously, probably even thinking about something else, I do it pretty well; but when my brain senses I'm close to finally doing a perfect run, I get nervous, and my consciousness, who sucks at playing games, takes over and I end up making really stupid mistakes.
In the end, when I actually flawlessly finish the level, it is more because I managed to somewhat finish the game consciously, rather than because I actually practiced. With levels with really tough endings, I can do more than a few hundred runs and never actually get to finish them, just because I get nervous at the very end.
How can I stop choking when playing games?