Amber solvatebox: How do I remove water that has traveled away
This has nothing to do with box walls (there are no walls!) or restraining the waters. You do not want to do that!

Do not confuse periodic boundary conditions with wrapping to the central cell. Look at the amber tutorials, it is all explained there.

You either need to set iwrap=1 in your amber minor put your trajectory trough cpptraj and use autoimage. 

Again, all in the tutorial and manuals.