You can't. If they want to move, they will move no matter what you put them in. If they're moving, it usually means they don't like where they're currently at so moving them back to the same location repeatedly usually just stresses them out more. What you can do is try to create the best environment possible for them to stay put and cross your fingers.
The BTA that I currently keep (and ones I've kept in the past) always seem to like rocks that have a nice size hole that they can put their foot in. The hole needs to be about the size of the foot or slightly larger, and it should be a pretty solid 'cup'. Basically, they want a solid hole where they can plant their foot where little critters in the tank won't have access to it (crabs, shrimps, etc). You can either take a piece of rock and try to find 'the perfect hole' or you can just drill a hole in either a piece of live rock or a piece of base rock. I've used this method with many BTAs and have had an extremely high success rate with them staying put.