Using coherent-state formalism (the Keldysh formalism), the article describes a transition from a homogeneous superfluid state to a supersolid state in a two-dimensional dilute gas of electron-hole pairs with spatially separated components. Such a transition is heralded by the appearance of a roton-type minimum in the collective excitation spectrum, which touches the abscissa axis as the distance between the layers or the pair density increases. This signals the instability of the system with respect to the appearance of a spatial modulation of the pair density. It has been found that a first-order transition to a hexagonal supersolid phase takes place a little earlier. A theory without phenomenological constants has been developed for an arbitrary relation between the effective masses of an electron and a hole. A phase diagram for the system has been plotted in the variables “the chemical potential of pairs – the distance between the layers.” It has been shown that there is a jump in the average density of the condensate during the phase transition. It has been established that with an increase in the chemical potential, the inhomogeneous phase breaks up into high-density regions surrounded by lines at which the density becomes zero, with these lines forming a continuous network.