Strive as much for this life as necessary.

Strive as much for the hereafter as it demands.

Strive as much for the pleasure of Allah as you need it.

Sin as much as you have the strength to endure its punishment.

Beg only from him who is not needy.

Disobey Allah only when you can hide from him.

Source: Pearls of wisdom part two.