Sounds like your losing spark or it's breaking down when it gets hot perhaps? Also, on a Toyota (obviously probably different) I can unplug my TPS and it will still run the same just idle higher and makes idle unadjustable. But if one of the 4 wires that went to it came unplugged it would not rev over 2K RPM. Any chance somethin got wet or even some moisture on or in it? Also when I had trash in my fuel system that time it did something similar but it was constant and was from idle up to 2500ish RPM's.