I had pretty much the same problems with my Galaxy Nexus running CyanogenMod 11 M12.
It got better by doing the following :
Blowing dry air in the earpiece… though the proximity sensor is clearly beside it. Can't do any harm though, I guess.
Settings/Applications/All/menu/Reset applications preferences (or whatever that's called in english) : that seemed to do a lot of good to my phone ! However, it's a very unsatisfactory answer on a technical point of view, as I still don't know WHAT was precisely needed. It's a "magic wand" solution for which I can't give an explanation.
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?