You need to set the keep alive settings within PuTTY to keep your session active.
There are 2 types of keepalives that you can configure. The 1st type will keep the connection alive, by simulating fake activity within the SSH session. These types of disconnections are done by the remote server when it perceives inactivity.
The 2nd type is due to a firewall that may be in between you and your remote SSH server. Again the firewall server perceives inactivity and drops your connection at the TCP level.
You'll have to determine which method is leading to your connection being dropped and then configure for it accordingly in the PuTTY configuration dialog.