Actually, if you want to beat an Ahri mid, just bring in Sona.
Sona is an incredibly cheap early game lane-bully that pretty much becomes an AP assassin mid game and a supporty mage at late game. And when i say cheap, it's because you can dodge pretty much any skillshots if you put any effort to it, but no one can dodge your Q and AA combo. It's guaranteed damage that an Ahri can't really heal, and if you're good enough at avoiding skillshots so you only use heal minimally, she will deplete her mana pool much earlier than you will. Run her out of mana, then kill her. When i have extra money i can't use for building my items i usually grab some Faerie Charms along for the buffed up mana regen, it really helps Sona stay ahead.
What you have to watch out for; CSing. You have to CS very well or most Midlaners will outfarm you and outscale you in mid-game. Try to do your combo Q+AA on Ahri while next to a minion your second Q shot will kill, and don't hesitate to use your Q enhanced AA (not necessarily counting powerchord) to CS more easily. Then, who can gank you? If no hard engage-go full AP and wreck things up. If the enemy team has a J4, Lee or Vi jungle for instance, you'll want to build health during mid game (basically right after rushing the Sheen upgrade), i suggest Rod of Ages as it also enhances your mana pool.
I normally use something similar to these builds;
or

Yes, i'm a terrible human being and Runeglaive Sona is a thing. I actually just smacked a fabled Runeglaive Ezreal's ass while playing it.