There's a common conspiracy theory amoung Turk's that Gulen (quite an interesting character) was the one that orchestrated the coup. He's in self exile in the US. Definitely worth looking into.
And apparently they were friends and supported each other before they became rivals and Gulen, a Sufist, was evaluated as a threat by Erdogan, so Gulen high tailed out of Turkey --given Erdogan's tendency to want to concentrate power, it looks like it was the wise choice.
first of all he didn't leave Turkey under Erdogan's rule, he left much earlier because secular forces knew what he was and the circle was closing on him. He Left Turkey in 1999.
That's the thing, its not a conspiracy theory. Everybody already believe, even secular turks like me, that Gulen was behind many things in Turkey like: The imprisonment of more than 1000 "secular" officers in the army since 2007 with the Ergenekon Operation, and later with the Balyoz operation. The irony is when we accused Gulen of being behind those operations, AKP and Erdogan were accusing the seculars for being conspiracy theorist.
https://en.wikipedia.org/wiki/Fethullah_G%C3%BClen