Magic Mouse disconnects randomly
As stated in the other answers there are numerous reasons to this. I have experienced 2.

Problems with the bluetooth antenna/signal

One of my Mac minis would drop the magic mouse, the keyboard and bluetooth headset regularly. I solved the problem by removing the antenna and putting it back (a few tries were necessary to get a stable connection).

On My macbook it seems the magic mouse and another bluetooth mouse seem to disconnect when the mouse is held in hand (hand covering the mouse) very close to the right side of the screen. It looks like there is a dark spot on the bluetooth antenna which prevents it from picking signal from devices positioned in particular places next to the computer.

My bluetooth headset loses the connection (drops some sound) when I stand next to the computer with my head and body between the computer and the right ear cup.

So you should check if you don't have a similar dark spot next to your computer. Or if the disconnections are not happening (more often) in particular situations which could impact the signal.

Batteries

Some batteries will start having problems with the contact, when oxidation occurs all you have to do is turn quickly the batteries in the mouse to remove the oxidation... If it's not enough you can try scratching the parts which are touching the mouse's contacts and the mouse's contacts with something metallic to remove any traces of oxidation.

Also tapping the mouse on the desk will increase the chances of batteries moving and shifting position just so slightly that they might be touching the connectors with a dirtier part.

Mismatched rechargeable batteries seem to create problems. Using two batteries both from the same brand but with different recharge cycles seems to trigger disconnections of my Razer mouse.

This answer also has a good explanation about how the battery level is calculated. It also states that some "cheap" batteries will discharge differently and will not be able to properly power the mouse after a short period of time:


  ...they can't supply the sudden bursts of power the radio in the mouse requires, so some transmissions are lost...


Other

One other major problem you might experience is interferences. You will want to have a look at this list of sources.