Not possible, as far as I know.
iOS will disconnect from WiFi if the phone is sitting idle after ~10-15 minutes, and no combination of settings can change that.
The developer of the iPhone WiFi presence sensor recommends against using it alone for exactly that reason.
From the thread I just linked to:
It’s only useful as one component of a mobile presence solution. Like with his combined presence app.