When two spherical particles submerged in a viscous fluid are subjected to an oscillatory flow, they align themselves perpendicular to the direction of the flow leaving a small gap between them. The formation of this compact structure is attributed to a non-zero residual flow known as steady streaming. We have performed direct numerical simulations of a fully-resolved, oscillating flow in which the pair of particles is modeled using an immersed boundary method. Our simulations show that the particles oscillate both parallel and perpendicular to the oscillating flow in elongated figure 8 trajectories. In absence of bottom friction, the mean gap between the particles depends only on the normalized Stokes boundary layer thickness δ * , and on the normalized, streamwise excursion length of the particles relative to the fluid A * r (equivalent to the Keulegan-Carpenter number). For A * r 1, viscous effects dominate and the mean particle separation only depends on δ * . For larger A * r -values, advection becomes important and the gap widens. Overall, the normalized mean gap between the particles scales as L * ≈ 3.0δ * 1.5 + 0.03A * r 3 , which also agrees well with previous experimental results. The two regimes are also observed in the magnitude of the oscillations of the gap perpendicular to the flow, which increases in the viscous regime and decreases in the advective regime. When bottom friction is considered, particle rotation increases and the gap widens. Our results stress the importance of simulating the particle motion with all its degrees of freedom to accurately model the system and reproduce experimental results. The new insights of the particle pairs provide an important step towards understanding denser and more complex systems.