Or are they just switching off?
No, the console will run out sooner, because it was designed so that it can't overheat. There's not screwed on the graphics, because the games have already been configured for the console suitable.
Should it get too hot, it is due to their location or a hardware defect may be present, such as clogged fans, for example.
I have no insight into the settings of the temperature control. But I assume that they shut down relatively quickly. Something like reducing graphics is not provided. If so, then the fan will turn on fully before. But I do not think the consoles have variable CPU and GPU clock rates (except perhaps in idle), and that's the only way to reduce performance.
Complement: As Eclair89 already writes, a console itself can't overheat except due to external influences (put PS4 on its side) or defects.