I would like to suggest something I was told while [I was working on my ties][1]. What you _could_ do is to use some clear nail polish, not a lot, to stiffen the ends of the ribbon. That should prevent them from fraying at all. It is likely that you could use something like a super glue to accomplish the same thing. 

You don't need a lot so, while it will darken the ribbon, if used sparingly it should not be noticeable.

[![Nail Polish on ribbon ends][2]][3]

<sup>Image from [Wikihow][3]</sup>

The page that comes from also suggests gluing as well as an alternative. It also covers using heat which [Stephanie's answer covers better][4].

Of course, that could also be seen as less then aesthetically pleasing. So to compliment my solution I would then suggest you use some thread and something simple like a tight overcast stitch. The thread will hold around the polish and hopefully distract from its presence. The nail polish alone should be enough to stop it from coming undone for a while. That would all depend on wear and tear at that point. 


  [1]: https://crafts.stackexchange.com/a/443/44
  [2]: https://i.sstatic.net/8HN0lm.png
  [3]: http://www.wikihow.com/Keep-Ribbon-from-Fraying
  [4]: https://crafts.stackexchange.com/a/1855/44