You can learn spells up to 9th level if your intelligence is 18, but you can only learn a maximum of 18 spells per level - you need intelligence of 19 or greater to learn more than that. You can drink Potions of Genius or similar that will temporarily increase your intelligence, thus allowing you to learn more spells than your intelligence would otherwise allow you to.
------------------