This question has been partly answered in MSE, see here.
In a paper On the Number of Elements of maximal order in a Group it is proven that an arbitrary group $G$ with a finite number of elements of maximal order has bounded size. Namely: $$|G|leqfrac{mk^2}{varphi(m)},$$ where $m$ is the maximal order and $k$ the number of elements that have order $m$.
I wanted to characterize all groups $G$, where the limit is sharp, i.e. $|G|=frac{mk^2}{varphi(m)}$. Using GAP I found all groups with this property up to order 1023 and was able to state a conjecture. It is easy to see in the paper, that a group has this property only if all elements of maximal order are conjugated. So we need this as as a requirement.
I wanted to prove the following conjecture, but missing some tiny part. Maybe someone knows a way, I would be really happy.
Conjecture.
Let $G$ be a group with $k<infty$ elements of maximal order $m$, in which all elements of maximal order are conjugated. Then the following are equivalent.
$i)$ $|G|=frac{mk^2}{varphi(m)}$
$ii)$ $k=varphi(m)$
$iii)$ $G$ has a unique subgroup of order $m$
$iv)$ $C_m cong C_G(x)=C_G(y)trianglelefteq G$ for all $x,yin G$ with maximal order
Proof.
$i) implies ii)$
This is the part, I could not prove:
I only could prove, that all elements of order $m$ commute:
Let $C_G(x)$ be the stabilizer of an element of maximal order. Orbit-Stabilizer-Theorem tells us, that $|C_G(x)|=frac{mk}{varphi(m)}$. Assume there exists an element of order $m$, not contained in $C_G(x)$. $langle x rangle$ operates via left-multiplication on $C_G(x)$. $C_G(x)$ is partitioned into $frac{|C_G(x)|}{m}$ orbits. According to Lemma 3 of the paper linked above, in each orbit exist at least $varphi(m)$ elements of order $m$, i.e. in $C_G(x)$ exist at least $varphi(m)frac{|C_G(x)|}{m}$ elements of order $m$. Our assumption tells us $varphi(m)frac{|C_G(x)|}{m} < k$, which leads to the contradiction $|C_G(x)| < frac{mk}{varphi(m)}$. It follows that all elements of order $m$ commute.
From here Derek Holt contributed a good point:
All elements of order $m$ commute, the elements of order $m$ generate an abelian normal subgroup $N$ of $G$ of exponent $m$. We now prove for an arbitrary $g in G$ with order $m$, that $C_G(g) = N$.
Let $g in G$ have order $m$. We claim that $C_G(g) = N$. To prove this, let $h in C_G(g)$. We want to show that $h in N$. This is clear if $h in langle g rangle$. Otherwise, since $m$ is the largest order of any element in $G$, $langle g,h rangle$ is a $2$-generator abelian group of exponent $m$, and so it is equal to $langle g rangle times langle hg^i rangle$ for some $i$ with $0 le i < m$. But then $hg^{i+1}$ has order $m$ and hence lies in $N$, so $h in N$, which establishes the claim.
So $(G:N) = (G:C_G(g)) = k$, and hence $|N| = mk/phi(m)$.
This is where we could not proceed further, maybe someone has an idea?
$ii) iff iii)$
If $k=varphi(m)$, an element of order $m$ generates a cyclic subgroup which contains $varphi(m)$ elements of order $m$, that all generate this subgroup. So there can’t be other elements of order $m$ in different subgroups. Otherwise, if there is only one cyclic subgroup of order $m$, then it contains $varphi(m)$ elements of order $m$, no additional elements of order $m$ can exist, as they would generate a second cyclic subgroup of order $m$.
$iii) implies iv)$ Let $Z$ be the unique subgroup of order $m$ and $X={x_1,dots,x_k}$ the set of elements of order $m$. As all $xin X$ generate $Z$, $Z$ must be contained in all centralizers of elements in $X$. Note that $G$ operates on itself via conjugation. Orbit-Stabilizer-Theorem tells us for $x in X$: $$|G|=|^Gx||G_x|=k|G_x|=frac{mk^2}{varphi(m)}=mk$$ This follows as all elements of order $m$ are conjugated and $k=varphi(m)$ holds. It follows, that $|G_x|=m$, which leads to $G_x=Zcong C_m$ for all $x in X$.
For the normal subgroup part, note that $phi(x_i)=x_j$ for an inner automorphism $phi$ and $i,jin {1,dots k}$. Let $y in Z$ be arbitrary, then $y=x_1^alpha$ for $alpha in mathbb{N}$. Let $phi$ be an arbitrary inner automorphism. It follows that there is a $i in {1,dots k}$ with $$phi(y)=phi(x_1^alpha)=phi(x_1)^alpha=x_i^alpha in Z$$ It follows that $Z$ is invariant under inner automorphisms, i.e. normal.
$iv) implies i)$ Orbit-Stabilizer-Theorem tells us that $|G|=|^Gx||G_x|=mk$. As all stabilizers of elements of order $m$ are equal to the same cyclic group of order $m$, it follows, that there exist only one cyclic group of order $m$, it follows $k=varphi(m)$ and $|G|=mk=frac{mk^2}{varphi(m)}$.
Another property, which my GAP-study suggests to be equivalent is :
$v)$ $G’$ is cyclic
This proof has low priority, as I first want to have my circle-implications. I guess I can show, that $G’$ is contained in the unique cyclic group $Z$ of order $m$, by proving, that $G/Z$ is abelian. I did not succeed yet, though.