According to the Wikipedia article on the history of Bukhara:
After the fall of the Kushan Empire, Bukhara passed into the hands of Hua tribes from the Mongolian steppe and entered a steep decline. However, the 5th century saw an unprecedented growth in urban and rural settlements throughout the entire oasis. Around this time the whole oasis territory was surrounded by a more than 400 km long wall.
I assume this structure dates to that period of construction?