Between 1 and 2, 2 is more basic as the 3 methyl groups would produce a +I effect resulting in better availability of the lone pair than in option 2.
I agree that more methyl groups would result in a greater +I effect.
But the book says it is 3. I don't understand why. I do make out that it is ionic, but how does this fact make it more basic than option 1?
The fully methylated ammonium part is not basic. It has no easily labile proton. As a result, tetramethylammonium hydroxide acts as a plain hydroxide salt, like sodium hydroxide. Hydroxide ion is much more basic than ammonia (at least in water).
So we've eliminated the amines with lone pairs as contenders for "most basic" because we've established hydroxide to be much more basic than an amine, regardless of the extent of the +I effect in an amine.
We're left with $\ce{NaOH}$ and tetramethylammonium hydroxide. The only difference between the two is the cation.
$\ce{Na+}$ is electron-withdrawing (electronegative); it has a positive charge. This lessens (stabilizes) the negative charge density on the hydroxide portion, reducing the basicity of the hydroxide ion slightly.
$\ce{(H3C)4N+}$ has a similar effect on the hydroxide ion part. However, tetramethylammonium ion has four inductively donating methyl groups to lessen its electron-withdrawing tendency. I suspect this is what your book is getting at.
Some speculation follows. In addition, $\ce{Na+}$ is likely smaller than $\ce{(H3C)4N+}$, which has a lot of bulk associated with its four methyl groups. This likely allows $\ce{Na+}$ ions to more effectively solvate and thereby stabilize hydroxide ions in solution. This again decreases basicity, but I'm unsure of how much of an effect this has, since the solution molecules will be present in a much greater quantity than the solute ions.