Are you doing other tasks on your computer when this happens? It may be suspending the program if you are not actively in it.
Is your computer going into "sleep" mode? I'm sure it's not.
Have you tried using Pronterface? It might not be your preferred choice but if it works it will be better than nothing.
Do you have the latest stable version of Repetier host? Check which version you have then check where you downloaded it. There may be a new update from your version that addresses this issue. If not, try an earlier version of the software.
Is your USB cable shielded? If not, make sure it is not crossing any power cables. This can cause interference in the signal.
Melzi has the micro SD slot. Try printing from the SD card. You can start your print in Pronterface, then disconnect your computer.
Check and make sure ALL your cables are secured properly. Loose or broken cables can cause a lost signal (especially power). Make sure you are not only attached by one thread in the wire. Also check for any corrosion on the leads.