I'm not sure that this phrase would be used frequently between friends or adults. I have said ti to my own parents and my parents have said to me in my adult life, but it's very much because we already have that existing history and tradition.
In a different relationship, it might be used affectionately, but not perhaps with the same sincerity as a parent would use with their child. Instead, I feel it would be used like a cliche where the person is wishing another a good night's sleep, but without necessarily the love and emotion associated with the phrase when said between a parent and child. By this I mean similar to how teenagers might display adult forms of greetings with their friends, such as hugs, but in some cases it's to mimic the actions rather than to truly display the emotions associated with the action.