It would help to know what speakers you had, but these three things come to mind:
1. Loose connection. Make sure all your connections are tight. These are connections from the speakers to the computer and from the amp (sub) to the individual speakers.
2. Bad sound card. When the speakers start acting up, be ready with another set or some headphones that you can swap in really fast. If you don't get sound from those either, then it's something with the sound card (most likley overheating). It the sound works, then it is your speakers.
3. Thermal protection circuit on the amp. The amp in your sub (used to power your speakers) has a thermal protection circuit in it. If it gets too hot, it kills the power to stop damage. First off make sure your amp is not covered by anything and that the vent holes are not being blocked by an object or dust. There is no fan in there, so air circulation is key. You usually get thermal induced shut down while stressing the system...aka gaming, especially at high volume. A common sign (altho not always) is that the speakers loose power completely (lights turn off and everything). You usually cause thermal shutdown when stressing the speakers, like gaming or playing music at high volume. If the above tests don't reveal anything, and your speakers work again after 5 to 10 minutes of being turned off, then suspect they are overheating. Clean out the sub and move it to a less shielded area.