It's actually a common misconception that dense construction was built right up against urban walls. I wrote about density, city walls, and development in some Italian cities here (with additional links to other answers, although the links to individual images might have died). There is also this other thread, with two perspectives on a similar question. The one important thing I bring up in those answers is that it's often important to keep in mind that wide green spaces were almost always accounted for between urban walls and the dense core. In the very largest of cities, notably like Rome, "suburban" communities could develop some ways away from the core while remaining within the city walls.
But as per your specific question, I would state that generally external sprawl was indeed very common. Cities always need an enormous amount of food to be brought in from the hinterland, so in a base case any urban space will be surrounded by farmland, and this farmland would itself be dotted with hamlets and manors whose residents' lives would be intimately linked to the city. In medieval Italian large cities like Milan, Bologna, and Verona, control over estates outside the city was indeed the primary power base of the local aristocracy. Other kinds of communities could include small settlements right outside the city gates, or settlements lining roads or waterways leading out of the city. In other instances, growth could indeed extensively spill out over the walls and into the surrounding countryside, but more often than not this would prompt the construction of a new wall, even if it was a mere palisade of stakes or earthworks (in addition to providing defense, walls are convenient points to collect tolls, so if sufficient economic activity is happening outside old walls the city is effectively forgoing tax revenue). The decision to extend urban walls or build new rings of walls is a common one following periods of urban growth (and the decision to convert a wooden palisade into a stone wall was often the hurried reaction to an unexpected threat, as the Milanese learned when the German Kaiser Frederick came to Italy). The examples I cite in the link above are those of Milan and Bologna, but innumerable european cities both large and small had multiple rings of walls developed in this way, so as cities expanded they could boast roman walls, medieval walls, and if needed, walls built during the renaissance or early modern period.
We don't always see these layers without targeted archeological efforts as oftentimes interior rings were deliberately demolished to make way for urban constructions once a newer (and larger) ring was completed. Other times, an onion-layered setup prevailed, although in these cases interior rings were often allowed to decay such that they eventually disappeared anyway: Even without a deliberate plan rings could be gradually swallowed up by encroaching construction (especially as aristocrats enclosed remaining inner-ring green spaces in private courtyards, appropriated segments of wall to build imposing facades, and found towers were an especially a useful addition to their homes). Lastly, inner walls could also be deliberately knocked down to create wide thoroughfares, pounding the wall's foundations into roadways (in Milan, again as an example, alternating segments of the wall saw both these fates).