It could be the thermostat, or the electric fan might not be working. Let it run for 15 minutes, idling, and see if the fan comes on. if it doesn't, check all your fuses.
If it isn't this, it could be a sensor problem. To properly diagnose it, you need to wait until it is happening and take to a...