The 18-year-old, who turns 19 on Sunday, made his Bundesliga debut as a late substitute against Augsburg in October.
He was contracted to the end of June 2015 but has agreed to a further two years in Gelsenkirchen.
Ayhan said on Schalke's website: "I am very happy about this because Schalke is my home club and it means a lot to me. I want to take my next sporting steps here in the coming years and gain a further foothold in the Bundesliga."
Ayhan, who has represented Germany at youth levels, recently said he would look to play international football for Turkey.