Ahri as a mage is very mana dependant, so if you can force her in any way to cast extra spells( without hitting you) is a good thing and makes her less of a threat. Also, work with your team mates and try to deny her the blue buff. That can make her go back to base more, which only goes to your advantage.
She is a slow mage in general( looking at starting values), so having run speed runes or starting with boots of speed can help you avoid her spells more easily, and also gives you an edge when you want to chase her.
While her main spell, the ball, can go through minions and is an excellent harasser, she greatly depends on landing her charm spell, which doesn't ignore obstacles. So, in order to avoid her combo in most cases, you only need to keep your distance and also always stand behind minions. Of course, this strategy works perfectly before level 6. After that, things tend to be more complicated, as she can close the gap, or dash through obstacles in order to get a clear shot. When her ulti is on CD, she is most vulnerable, as she doesn't have that much mobility. That makes her an easy target, which you should exploit.
Every champion has a certain way how he works, and Ahri relies on quick burst and mobility. If you can counter that, she is much less effective. So look for champions/items that can negate her in that manner. As I said before, her main abilities are skill shots, which can either miss or be useless if she has an obstacle in front of her. Hide behind minions or crowds in team fights, so she can't target you easily.
Also opt for items like Quicksilver sash or Banshee's veil which can disrupt her combo, or force her to cast extra spell, which can be very helpfull.
And, finally, some champions are simply better then others when you fight a certain nemesis of yours. In case of Ahri, at least in my experience, I had most difficult times fighting against Kassadin, Lux, Fiddlesticks and in some degree Fizz. In fact, any champ that has good damaging abilities which can pass through obstacles and directly hit her, can do the job.
Personally, Fiddlesticks was maybe the worst enemy I had to play against( as Ahri). Because of his "Dark wind"(if the name is right) ability, which hops between enemies + silence effect, and also has ridiculuos range and can almost always reach her even if she stands a bit away from her minions. It is a perfect harasser against Ahri, because it forces her away from battle, disrupts the farm and in general is really really annoying
Of course, in time, you learn how champions that you often fight against work( in case you play only mid), and it gets easier to counter them, or at least you don't feed them anymore
Even tho I am glad if any of my suggestions could be of help to you, and I wish you luck in the future....a part of me hopes for your fail, as Ahri is my favorite champ :P