What is the input voltage to the 5V regulator?

Suppose it is 12V. Then 12-5=7 volts drop on the regulator.

With a 0,7A current this gives a 0,7 x 7= 4,9 Watts of heat on the regulator. Too much! That is why it gets hot.

Here is a very good link to calculate heat sinks. Read it all as it has very good points.

http://sound.westhost.com/heatsinks.htm

To quickly end with your problem, put the regulator on a large aluminium heatsink,say 4x4x2 cm or lower input voltage to 8 volts.

Ioannis