Piper Jaffray Cos. is buying Sandler O’Neill & Partners L.P. for $485 million, combining two investment-banking firms and creating Piper Sandler Cos.

The news confirms a Wall Street Journal report Monday that said the companies were getting close to a deal.

Sandler O’Neill is a leader in advising small and midsize banks on deals, having been...