I have had this happen as well on occasion. I also had a time where my ankle would totally give out on me and I'd end up spraining it... you can imagine how fun that was. There was a period of a few months where I could barely walk. Turns out that I had some misalignments in my knees, which is all tickety-boo now with orthotics.
If this is happening to you a lot, it might be worth getting checked out as it could be a very simple fix.