I have a sitecore instance sc8.2u3 in my local PC. When the CMS or live is not visited or idle for a while and I browse it again, the page doesn't load and shows this error:

Cannot open database "MySiteSitecore_Web" requested by the login. The login failed. Login failed for user 'sa'.

After refreshing a few times or loading the page in another tab, it then shows this error:

Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.

Again after refreshing the page or loading it in another tab will finally load the CMS/live site correctly.

It was working fine but recently started behaving this way and this happens frequently.

What could be the reason and how can i fix this.