Is it possible to classify finite nonabelian nilpotent groups with at most four maximal subgroups? Is it possible to answer the question for finite nonabelian solvable groups?
A finite solvable group $G$ which is not nilpotent and has at most $4$ maximal subgroups satisfies $G/\Phi(G) \cong S_{3},$ where $\Phi(G)$ is the Frattini subgroup, the intersection of all maximal subgroup of $G.$ Suppose $G$ is solvable, not nilpotent, and has at most $4$ maximal subgroups. Suppose also that $\Phi(G) = 1,$ which is no loss of generality. Then $G$ has a maximal subgroup $M$ which is not normal. Then $M$ has at most $4$ conjugates, and there is at least one maximal subgroup of $G$ which is not conjugate to $M.$ Now $M = N_{G}(M)$ by maximality, as $M \not \lhd G.$ We have $[G:M] < 4,$ but we can't have $[G:M]= 2$ as $M$ is not normal. Hence $[G:M] = 3$ and $G/K \cong S_{3},$ where $K$ is the intersection of all $G$conjugates of $M.$ But then by the isomorphism theorems, there are $4$ maximal subgroups of $G$ containing $K.$ These are the three conjugates of $M,$ together with a normal subgroup $L$ of index $2.$ But this yields $K \leq \Phi(G)$ since $G$ has at most $4$ maximal subgroups. By assumption, $\Phi(G) = 1,$ so that $K = 1$ and $G \cong S_{3}.$ It's actually possible to analyse the nilpotent case in a similar manner, and go a litle bit further than Arturo does. If $G$ is finite nilpotent with at most $4$ maximal subgroups we may reduce to the case $\Phi(G) = 1,$ so that $G$ is an Abelian group of squarefree exponent. If $G$ has a noncyclic Sylow $p$subgroup for some prime $p,$ then there are at least $1+p$ maximal subgroups whose index is a power of $p.$ If $G$ is not a $p$group, there is at least one maximal subgroup of $G$ containing a Sylow $p$subgroup of $G,$ and we have then exhibited at least $2+p$ maximal subgroups of $G,$ so $p=2.$ Even when $p=2,$ it easily follows that $G$ is the direct product of the form $A \times B,$ where $B$ is a cyclic $q$group for some odd prime $q$ and $A$ is a $2$group which may be generated by $2$ elements. The ultimate conclusion is that a nonAbelian finite nilpotent group $G$ which has at most $4$ maximal subgroups has one of the forms: A nonAbelian $3$group which can be generated by $2$ elements; a group of the form $A \times B,$ where $A$ is a nonAbelian $2$group generated by $2$ elements and $B$ is a cyclic $q$group for some odd prime $q$ ($B$ may be trivial). 


A finite nilpotent group is a direct product of its $p$parts, and maximal subgroups have prime index; so you have at most four primes dividing the order of the group. If $G$ is a $p$group, then $G/\Phi(G)$ is an elementary abelian $p$group; if it has order greater than $p^2$, then it has more than $4$ maximal subgroups; and if $p\gt 3$ and $G/\Phi(G)$ has order $p^2$, then you have more than $4$ maximal subgroups. If $G/\Phi(G)$ is cyclic, then $G$ is cyclic and has a unique maximal subgroup. This reduces the problem to $p=2,3$, $G/\Phi(G)$ of order $p^2$, and then to a restricted way in which you can add direct factors. 

