In response to problems concerning the low autonomous localization accuracy of mobile robots in unknown environments and large cumulative errors due to long time running, a spatial location representation method incorporating boundary information (SLRB) is proposed, inspired by the mammalian spatial cognitive mechanism. In modeling the firing characteristics of boundary cells to environmental boundary information, we construct vector relationships between the mobile robot and environmental boundaries with direction-aware information and distance-aware information. The self-motion information (direction and velocity) is used as the input to the lateral anti-Hebbian network (LAHN) to generate grid cells. In addition, the boundary cell response values are used to update the grid cell distribution law and to suppress the error response of the place cells, thus reducing the localization error of the mobile robot. Meanwhile, when the mobile robot reaches the boundary cell excitation zone, the activated boundary cells are used to correct the accumulated errors that occur due to long running times, which thus improves the localization accuracy of the system. The main contributions of this paper are as follows: 1. We propose a novel method for constructing boundary cell models. 2. An approach is presented that maps the response values of boundary cells to the input layer of LAHN (Location-Adaptive Hierarchical Network), where grid cells are generated through LAHN learning rules, and the distribution pattern of grid cells is adjusted using the response values of boundary cells. 3. We correct the cumulative error caused by long-term operation of place cells through the activation of boundary cells, ensuring that only one place cell responds to the current location at each individual moment, thereby improving the positioning accuracy of the system.