Installing swinging gate - how to prevent gate post lean
First off I don't think you're likely to have trouble with a properly set 4x4 post and a 4' wide gate.  The 4x4 should be stiff enough, and if the embedment is solid, it shouldn't lean with the weight of the gate.  

One thing you can do is to make sure the gate is supported on the latch side when it's closed, so the post is only taking the weight of the gate while it's open.  This could be something as simple as a heel on the latch post that catches the bottom of the gate.  

If your neighbor's fence is sturdy - not sure if that's the case, there's some rot at the bottom of the boards - and the neighbor will allow, you could bolt through the posts so they bear the weight together.