My Google Nexus 4 does the same thing and I found this on a forum:
It really needs to be said that graphite powder permanently fixes the problem with getting stuck in headset mode.
Go to a hardware store, pick up a tube of graphite powder for around $3.
1) Gently squeeze a couple puffs of...