What are your temps? It sounds like you are thermal throttling. When the CPU gets too hot, it shuts itself down to prevent damage. So when you are idling and doing basic stuff, the CPU does not have to work hard and the temps are low. But when you game, the CPU works much harder and gets hot, so it is shutting itself down.
Download hwmonitor and run a gam in window and watch your CPU package temps from hwmonitor. If they are getting in the 80s or higher shut it down. There is something wrong with your cooling.
Did you replace the CPU cooler recently?