Rashi writes that the reason Parshas HaNazir follows Sotah is because the future Nazir will see how wine led to the Sotah case and will now take an oath of Nazirus, forbidding wine to himself. But how does Sotah fit into the story of Bamidbar up until Perek 5? How is it connected to the Pekudim and the formation of the Machane?
The Ramban says that the reason the hashka'as sotah is the only mitzva in the Torah where we rely on a nes is because it relates to the purity of the lineage of klal yisrael which is a pre-requisite for the hashra'as ha'shechinah.
Therefore it follows that parshas sotah should be stated subsequently to the formation of the machaneh because Hashem was only mashreh His shechinah on the machaneh in the merit of their fidelity.
Incidentally, Rashi comments on the addition of heh and yud to the families names (heh at the beginning, yud at the end) that Hashem added His name (yud heh) to theirs in this merit.
As we sing on Shabbos, shivtei kah le'yisrael edus.