By 1093, the western limits of Galicia included portions of Miranda, that included the Douro River, falling under the dominion of the county of Portucale and successively ruled by Count Henry, his widow, the Countess Teresa, and their son, Afonso Henriques. In 1136, Afonso Henriques conceded a Foral (charter) to Miranda and converted the site into a military outpost, even as a fortification already existed at the site. During this period the town was already defended by a castle, left in ruins by the struggles of Reconquista.
Following the campaigns to take Galicia, in 1135, Afonso Henriques was encouraged to restore castles, monasteries and churches in strategic places along the Miranda do Douro. Aiming to build up the settlement and defense in their time of peace, the village received tenure in 1136, coming to be in place Couto and safe haven. The town grew around the castle, by the end of the reign of Henriques. In the following years, successive monarchs re-issued the forals, that included the 1217, re-issue by D. Afonso II and, the 1286, renewal by King D. Dinis, who issued orders to proceeded with work on the site. Then between 1294 and 1299, King D. Denis ordered the reconstruction of the castle. The struggles between D. Sancho I and his son/successor, Afonso II, along with support from Alfonso IX of León, resulted in the lands Miranda being occupied by Leonese forces who, ultimately, returned the castle to Portugal, in 1213.
In 1325, the settlement was elevated to the status of "town".
Miranda was returned to Portugal in 1371, following the Treaty of Évora. After its return, in 1383, the fortification walls and military square improved under the direction of Pedro Homem de Távora.
In 1400, the Master of Alcântara encircled the square, but eight years later, it was converted into a sanctuary town.