shloshah anashim nitzavim alav - three men were standing near [on top] him

At this point the Torah repeats the word vayar as only now did Avraham see these people close up.  At this point he also realized that they were angels.  This is why the Torah writes that Avraham ran towards them and prostrated himself before them on the ground.  The angels were Micha'el, Rafa'el, and Gavri'el. 

Micha'el had been assigned the task of announcing that Sarah would have a child and to save Lot.  Both of these assignments were expressions of G-d's love or mercy respectively, and could therefore be described as being of the same category.

Rafa'el had the task of healing Avraham.

Gavri'el's task was to turn Sedom upside down.

This is why the Torah writes "the two angels arrived at Sedom in the evening" (19:1)  This is a reference to Micha'el and Gavri'el.  Since it was Micha'el's task to save Lot we find that when describing the destruction of Sedom the Torah uses the singular when it writes "he turned these cities upside down" (19:25), instead of writing "they" turned these cities upside down. 

We learn from this that whereas one angel may not carry out two tasks of difference categories, such as one that emanates from G-d's Attribute of Justice and another emanating from the Attribute of Mercy, he may carry out two assignments when both originate from the same attribute, in this instance the Attribute of Mercy.  This is why we find Micha'el performing what appear to be two separate tasks.  He gave Sarah, who had previously been unable to conceive, a message of love and hope, and he saved Lot who did not have a valid claim to be saved.

Why was a special angel needed to heal Avraham?  Could not Micha'el have performed this task also?  The fact is that healing, especially people who deserve to be healed, is not part of the heading of performing an act of loving kindness.  If Micha'el had accepted that assignment he would have trespassed on Rafa'el's territory.  This is why G-d assigned to each of these angels only tasks which were within their respective spheres of competence.

It is not permissible in the celestial regions to have overlapping areas of competence; this is what is meant by Iyov 25:2 "He imposes peace in His celestial regions."  If you look at our paragraph with an analytical eye you will discover that G-d granted Avraham an insight into the workings of the celestial hierarchies.  These three angels were the respective heads of three of G-d's armies. They were part of the four encampments (armies) surrounding the Shekinah (Divine Presence).

Whenever you encounter the archangel Micha'el you encounter the glory of the Shekinah (Shemot Rabbah 2:8).  Whem Avraham beheld these three angels and he ran after them he was actually running after the Shekinah, trying to welcome it. 

As to the fourth "army," G-d employs His forces in accordance with the requirements of the occasion.  The fourth army had already been revealed to Avraham in Chapter 15 during the episode of the Covenant Between the Pieces.