iPhone 4s can't keep Wi-Fi connection
The Broadcom chip that controls the Wi-Fi connection has been known to be faulty in the iPhone 4s. I'd take it into a repair shop, as the fix requires the solder to be melted under the chip with a heat gun and it is very easy to mess it up.

You can see the details of the repair on this iFixit guide.