Yes, stay away from the edge.
Use planets in combination with asteroids to make "walls" when needed. Be careful with asteroid placement as to many in a system will make the map un-loadable into the game. You can use resources (until they are mined) as ship blockers also. If you're trying to make a 'great wall' forget it as the game AI will just get 'confused' as to what to do.
Asteroids only slow down a ship, they do not keep it from going through it. I don't know what you plan to do, but you can't effectly wall off any part of the galaxy as this is only a two dimensional game map and not the realistic 3D. In 3D you could easily go around or over your wall.