Our bosses are always very egoistic. Never ever hurt their ego. if you have to, do it when you meet him personally.
Make your boss feel the smartest guy in the office. You don’t have to lie for this, you just need to notice the good gestures/traits of his character and praise those in public or private. Another mind hack: when you praise someone, first say what for are you praising and then explain WHY are you praising. And finally, show some interest in it. For example, if you like the watch of your boss,
you – that watch is marvellous! (you said WHAT). the colour combination is more than perfect ( you explained WHY), where did you get it? ( you showed interest in that watch)
Give a gift occassionally, doesn’t matter how small is that, shows that you think of him/her even if you are not in the office. This will get you a huge return eventually.
Finally, if someone comes to you and start bad mouthing about your boss, don’t put yourself in that trap by supporting that, instead quickly jump into some other conversation and bypass the badmouthing. in that way you keep your friendship alive and also keep yourself safe from office politics.