Are there rules or guidelines on when and where to use the kanji spelling for this word? From my own observations, it seems like it is spelled 余り when used as a noun meaning remainder or leftovers:
飲んだ余りを捨てる。
an act of tossing out the remains of drinks
Or as a suffix to a counter meaning more than that amount:
私の両親の家は、ここから電車で2時間余り離れています。
My parent's house is just over 2 hours away from here by train.
In it's other uses it seems to be spelled あまり.
Indeed, in this other post, there are some examples of this. And I also realize that some kanji words are written in kana, but this seems to be a little more rigid than personal preference or maybe I'm reading too much into it.