The treaty between Ramon Berenguer and his father-in-law stipulated that their descendants would rule jointly over both realms. Even should Petronila die before the marriage could be consummated, Berenguer would still inherit the title of King of Aragon. Both realms would preserve their laws, institutions and autonomy, remaining legally distinct but federated in a dynastic union under one ruling House. Historians consider this arrangement the political masterstroke of the Hispanic Middle Ages. Both realms gained greater strength and security and Aragon got its much needed outlet to the sea. On the other hand, formation of a new political entity in the north-east at a time when Portugal seceded from Leon in the west gave more balance to the Christian kingdoms of the peninsula. Ramon Berenguer successfully pulled Aragon out of its pledged submission to Castile, aided no doubt by the beauty and charm of his sister Berenguela, wife of Alfonso the Emperor, for which she was well-known in her time.
In the middle years of his rule, his attention turned to campaigns against the Moors. In October 1147, as part of the Second Crusade, he helped Castile to conquer Almería. He then invaded the lands of the Almoravid taifa kingdom of Valencia and Murcia. In December 1148, he captured Tortosa after a five-month siege with the help of French and Genoese crusaders. The next year, Fraga, Lleida and Mequinenza in the confluence of the Segre and Ebro rivers fell to his army. The reconquista of modern Catalonia was completed.
Ramon Berenger also campaigned in Provence, helping his brother Berenguer Ramon and his infant nephew Ramon Berenguer II against Counts of Toulouse. During the minority of Ramon Berenger II the Count of Barcelona also acted as the regent of Provence (between 1144 and 1157). In 1151, Ramon signed the Treaty of Tudilén with Alfonso VII of León. The treaty defined the zones of conquest in Andalusia in order to prevent the two rulers from coming into conflict. Also in 1151, Ramon Berenguer founded and endowed the royal monastery of Poblet. In 1154, he accepted the regency of Gaston V of Béarn in return for the Bearnese nobles rendering him homage at Canfranc, thus uniting that small principality with the growing Aragonese empire.