I can think of three probable causes for this.
1. Have you or another user changed any of Firefox's Security Settings or Advanced Settings recently? There are some settings there for surfing by proxy and things like that that can affect your ability to connect or stay connected to the internet. If you think this may be the case then this page can show you how to restore the default settings in Firefox:
2. This could also be caused by an add-on. If you have recently installed an ad blocker or pop-up blocker you could try disabling it to see if the problem ceases. This is most likely not the case though unless you've installed an obscure add-on because most of the popular ones work fine.
3. It's possible Windows Firewall is causing problems for Firefox. Mozilla has instructions on how to make sure Windows Firewall allows Firefox to connect to the internet here:
Usually when this happens you can't connect through Firefox at all though. Since you can connect but keep timing out this probably isn't the case but it won't hurt to give it a try. Well, not if you follow the instructions anyways. You
can make a mess of things tinkering with Windows Firewall settings but you should be fine if you follow the instructions on that page.
Hope this helps.