How does market work when there are few buyers and few sellers at the same market? If I understand it right, correct term for such situation is bilateral oligopoly.
Hendricks and McAfee (2007) offer a theory of bilateral oligopoly. They consider the example of the wholesale gasoline market on the west coast of the United States, which is composed of a small number of large sellers and large buyers who compete against each other in the downstream retail market. They are specifically interested in the effect of a merger of vertically integrated firms on the whole sale and retail markets. They discuss price and cost formation. They also offer a review of the literature.

The extreme case is bilateral monopoly with one buyer and one seller. Tirole's Industrial Organization  textbook (pp. 21-25) offers a nice discussion of how this market works and in particular price behavior under bargaining and contracting.