Has this started recently? If so, I'd advice to go and change the battery. Overheating can occur if the battery is damaged or about to 'die' or if for some reason, the charging/power circuitry inside the phone has a short of some kind or faulty connection. Or if you have an app or process that is using the processor intensively, it will also heat the phone up (there's a circuit, however, that should protect your phone from reaching critical temperatures and will automatically shut it off).
If there's an app that's causing it, try booting your phone into Safe Mode. If the heating up doesn't happen there, then there's an app that's causing it. Find that app, disable it, and you'll be OK.