If it is a good friend or one you have had for a long time, don't pay any attention to them for some time (don't respond to texts, FB messages etc or peacefully decline such things). If they really do value your friendship they should mature up a bit in response to the sudden lack of contact and interaction.
If they continue acting in a ridiculous manner or they are more 'associates' than friends, give them the boot. Sometimes it's hard but in the end it will save you a lot of fuss.
I've done the whole 'ignoring thing' (reason I put it in quotations is that ignoring someone is generally interpreted as immature - but if done the right way it solves a lot of problems) to both short & long term friends and it has worked well. I even had it used against me a few years back when I was having a bit of stress-induced-immaturity; gave me a reality check.