There are many ways of saying goodbye, just as there are many of saying hello. it is important to use an expression of the appropriate tone and register. in the end, it's all up to your judgement but remember that using a very formal expression with some-one who is your friend, as it may sarcastic.