Are you using gravity modules? They lock you to the ships gravity and should prevent you from being knocked around. I do notice sometimes with 1 block thick walls you can still end up going through the walls during sector switches, but otherwise I never have this problem.