Read Cal Newport's book Digital Minimalism. The only real long-term solution is to change your relationship with your phone.
It doesn't need to be within reach at all times. You probably barely need it at all, maybe 1% of the time. Just turn it off and leave it home unless you know you'll need it.