Routers and modems (and router-modem combos) are essentially little computers. For the most part, they can run 24/7 without a problem, but the longer they stay on without a break, the more likely they'll develop software errors. Errors that can cause a disconnection.
It may be a cliche, but when your internet stops working, the first thing you should do is restart your equipment.
Even if you haven't encountered any errors it's a good idea to periodically restart your router and cable modem (especially the router). Once per month is a good pace. This will help keep your connection working and should reduce the possibility of losing internet at an inopportune time. Some routers make this easy with an on/off button, and some have features that allow you to program an automatic restart on a schedule.