I have had to buy gifts for a boss several times. Actually I didnt HAVE to, I wanted to. Fortunately I worked closely with him and knew his habits and what would be useful to him.
He was forever misplacing his pen and couldnt find anything to write with so a little stocking stuffer was a pen on a rope that you hang around your neck so you cant lose it. He loved it and wore it all the time and it was under$3.00. A gift doesnt have to cost a lot to be of use.
On one occasion I bought him a new briefcase.
He loved music and travelled a lot so I bought him a cassette holder and a couple of cassettes he had been wanting.
Not everyone will know their boss as well but their are things you can buy that they can always use. Perhaps a coffee mug(insulated) with their name on it, filled with a special kind of coffee they may like(packet form of course) or even filled with candy.
Any desk type accessory, pens, name plates, ink blotters, a special calendar, a special picture frame for family pictures, maybe even a special lamp.
If your boss is a lady then flowers make a nice gift given in a container that can be re-used.
A basket of fruit is always a good gift for anyone that you are stumped on buying something for.
Bosses birthday? Everyone get together and get a big cake and some ice cream and throw a party complete with balloons and everyone chip in on a gift.
Of course when in doubt there are always gift certificates depending on what type of thing your boss is into. I worked in the computer related field and the boss was big on computers at home as well as at work so a GC from a computer store can be a good gift.
Dont get too personal on a gift for the boss. Never give your boss socks or the like.This would not be fitting.