This applies to two stars also. They can be held in orbit by their mutual gravitational attraction. This is common. Roughly half of stars are found to be such binary star systems.
Each star orbits in an elliptical orbit about a point in space between the two stars. This point is called the center of mass. The center of mass is nearer to the heavier star:
M1/M2 = r2/r1
Each star moves in an elliptical orbit about the center of mass. (That
is, one focus of the ellipse is at the center of mass.)
Newton's laws relate the sum of the masses of the two stars to the period P and the semimajor axis a of the orbit:
Davison E. Soper, Institute of Theoretical Science, University of Oregon, Eugene OR 97403 USA soper@bovine.uoregon.edu