In general, adding extra confectioner's sugar or chilling runny frosting helps firm the mixture. However, the best thickening method may differ depending on the type of frosting. For example, runny whipped cream icing firms after being thoroughly chilled, while runny royal icing is best thickened by adding extra meringue powder.
Firm runny Italian buttercream frosting by adding cold, but softened, butter to the mixture. For whipped cream or American buttercream, try adding a couple of teaspoons of cornstarch to stabilize and thicken it. Blindly adding more confectioner's sugar to runny frosting may thicken it, but may also yield an end result that is too sweet. Try adding extra sugar to half of the frosting before combining it with the second half.