Way I see it, the wish system doesn't even let the genie cheat. So if you could make wishes and have them granted non-maliciously, then wish for some open-ended power (eg. magic based on the same principles as the genie's ability to grant wishes), wish for knowledge, then last wish is for the genie to go away and never interfere with you again.
You do indeed want to make the third wish, because if you're now the most powerful person, the most knowledgeable person, having the lamp still be around is a weakness because other people could find it and wish your power away.