Start/Run/Regedit
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters. In the right pane, find Autodisconnect and change the time accordingly.
Or...
Start/Run/net config server /autodisconnect:30 (30 being an example). The valid value range is -1 to 65535 minutes at the command line. To disable Auto-Disconnect set it to -1. Setting Autodisconnect to 0 does not turn it off and results in very fast disconnects, within a few seconds of idle time. (However, the RAS Autodisconnect parameter is turned off if you set it to a value of 0.)