I am aware that in medieval times, tunnels (or saps) could be dug to get close to the foundation of the walls and towers, enabling experienced engineers to knock them down (using pigs on fire, for example). However, common sense tells me that these techniques were not worth the effort in later centuries.
During the 17th century, combat for control of tunnels was primarily enacted as a defensive maneuver utilized by a besieged fortification.
Defenders would counter-mine to prevent successful entry into the fortification or collapse of major defensive walls. Once the defenders located the attackers tunnel, combat for control of the tunnel would take place. In the event that no counter-mine attempts were made to intercept the attackers tunnel, the defenders would instead provide fierce resistance at the main breach and attempt to gain tunnel control by force of arms.
Some fortifications were built with counter-mine galleries to provide the defenders with the ability to detect tunneling activity from the safety of their own walls.
In reference to "pigs on fire" ~ some attacking sappers would use the carcasses of dead pigs (their fat known to burn with intense heat) to destroy the supports of their tunnels, bringing on the collapse of fortifications.
As time went on, major developments in rifling and explosive devices rendered wall fortifications obsolete. Thus, tunnel mining to capture a fortification became unnecessary.
Fighting for control of tunnels was still exercised during WWI, WWII, Vietnam, and even as recently as the Lebanon-Israeli conflicts ~ although for varying reasons and strategic needs in each conflict.
I leave you an excerpt from The New Cambridge Modern History, chapter "Military Forces and Warfare 1610-48", illustrating mining siege tactics during the 17th century:
“Once the foot of the wall had been reached, usually, after the requisite mine galleries had been dug out, an attempt was made to blow it up. Both of these tasks were always given to experience sappers or professional miners. It sometimes required weeks of struggle underground before before the breach could be stormed. Often, however, the defender did not allow things to reach this extreme, but capitulated in order to avoid the slaughter and plundering which, according to the rules of war, inevitably followed upon capture by storm; and also to obtain favorable conditions.”
Sources and suggested reading:
The moment you believe that an avenue of approach is not useful and not worth defending is the moment when a good strategist will use that particular approach to your disadvantage.
Tunneling is labor-intensive, aimed against fixed locations, and best used where there isn't a lot of underground infrastructure, e.g., sewer lines, power lines, and natural gas conduits. It would not work well against a mobile enemy or a location with potentially dangerous underground infrastructure.