Pipes leak when the chest they're connected to is full regardless of whether there are empty chests right next to it on the pipe network.
To avoid entities leaking out, building up and lagging the server, placing lava under an overflow pipe near the chest will have your extra unwanted materials burned up:
Of course this is fine for the likes of cobble, gravel and dirt, but you don't want your valuable ores and gems to head this way too.
A system is needed that will filter out the stuff we don't mind losing when our chests are full, with the stuff we want to keep. At the same time though, we need to keep the entity counts as low as possible!
An over simplified way of routing items from your quarries would be this:
The quarries eject their materials into the pipes on the right. They then enter the Iron Pipe.
What the Iron Pipe does, is create a sort of one way valve. The non shaded part of the Iron Pipe is the output. No items can enter this point. This prevents entities travelling from one quarry to the other and popping out of the pipe there. So that's one potential leak problem avoided straight away.
If the Iron Pipe isn't facing the way you want it to when it's placed, right click it with the black Wrench until the output is at the desired location.
REMEMBER!: whenever you have a junction of pipes, whether a T or + shape, consider using an iron pipe to prevent back flows and leaks.
Now onto the Diamond Pipe. This is where the items are sorted before being sent on their merry way. It's very important you place the sorting pipes in front of the chests in your piping chain as moving items from chest to chest is both inefficient, and likely to cause leaks and lag.
Using a Diamond Pipe is as simple as right clicking it and putting the items in their respective colour coded boxes to where the output is.
Here in this image, I've told the Diamond Pipe to route all Dirt and Sand to the Red output, any items not on the list will get sent to the other outputs:
Because dirt, sand, cobble etc are common, it's highly likely that the chest will overflow. In case this happens, I've place lava underneath the point where the pipe connects to the chest to burn off the excess entities as they leak out of the pipe.
The other chest on the other hand, is less likely to overflow while going unchecked for periods of time.
When you have long runs of piping carrying entities, I highly recommend using Gold Pipes. Gold Pipes give the entities a speed boost. This not only gets the items to you more quickly, but results in less items flowing through the pipes at any time, thus, reducing Entity counts.
You will need to power it with redstone for it to function. Simply placing a Redstone Torch beneath the pipe will suffice:
Another source of problems is when pipes and sorting systems straddle a chunk border. You can make sure your system is inside a single chunk by turning on chunk border lines in your minimap.
To do this, press the map menu key (default is the period (.) key) and going to Surface Map Options, and Enabling "Show Chunk Grid". Now when you view your fullscreen map with the # key you'll see your chunk borders:
As a footnote, I will state though that RedPower Tubes are far superior to BuildCraft Pipes. They are however more expensive and of higher tech level to make than BC Pipes and so not always accessible. In cases like managing the outputs of Quarries, unfortunately BC Pipes are our only option until past the initial sorting and storing state.
I'll go through using RP Tubes effectively for automated maceration, smelting and storing, with an alternate way of handling the outputs of quarries in a future post.