Is it a good idea to use a single heatsink for two IC's?
Using a single heatsink is very common - sometimes it can even increase performance (thermal matching of discrete transistors for helping against thermal runaway or better matching).
However, there are a few things to watch out for:
How big does your heatsink need to be?
Using multiple parts on a single heatsink could make thermal calculations a bit more tricky. Are all your parts going to be putting out the maximum heat they can during normal operating conditions at the same time?
If not, you don't need as big a heatsink. However, the math on figuring out what size you need can be a bit trickier.
What about isolation?
When using multiple devices on a single heatsink, you need to take care that you are not shorting out bits of your circuit. Many packages have metal tabs to connect to heatsinks (such as the TO220 package). However, these metal tabs are often also connected to a certain pin internally. Check your part's datasheet to see how it is connected. Take a look at the following schematic:
simulate this circuit – Schematic created using CircuitLab
If we were to connect these two parts to the same heatsink, without isolation pads, we would be shorting the input transformer! This is clearly not a good thing. Therefor, we often use either separate heatsinks, or isolation pads. These are pads commonly made out of thin pieces of ceramic (Mica is common) or some other electrically insulating material. Make sure that when you use these pads, you also use the propper screws or protection sleeves for the screws! If you isolate the metal tab, but don't isolate the metal screw, you will just short it out through the screw.
The other answers here are great, however I would also like to add...
CONSIDER EXPANSION EFFECTS
When mounting multiple devices to a heat-sink some care is needed to account for the fact that the heat-sink itself is going to expand at a different rate from the PCB substrate which your devices are presumably soldered to.
If that difference is significant it will exert a LOT of stress on the legs and solder joints of the devices. This is particularly detrimental if the devices are surface mount devices where the mechanical connection is already poor. Best case the joint will fail. Worst, the pad and track will rip out of the board.
These effects can be alleviated somewhat by keeping the parts really close together. Putting them at different ends of the same heat-sink is generally a bad idea.
However, I would still not rely on proximity for SMT parts.
A better solution to mount the devices to the heat-sink using a softer mechanical connection that allows an appropriate amount of slippage between the device and the heat-sink. For example, heat-sink-clamps.
Use a sufficient amount of heat-sink compound to act as a lubricant to ease the slippage while maintaining the appropriate amount of thermal contact.
You can use a single heat sink with two components if
- The mounting tabs of both components can be electrically connected, or you explicitly insulate at least one of them.
- The total power budget and max temperatures are still met.
Add up the worst case power dissipated by both devices, and see what temperature rise the heat sink will cause. Make sure the result is acceptable to both components. If you end up electrically insulating one of them, be sure to take the extra thermal insulation caused by that electrical insulation into account.