In this paper we study the inefficiencies of the monetary equilibrium and optimal monetary policies in a search economy. We show that the same frictions that give fiat money a positive value generate an inefficient quantity of goods in each trade and an inefficient number of trades (or search decisions). The Friedman rule eliminates the first inefficiency and the Hosios rule the second. A monetary equilibrium attains the social optimum if and only if both rules are satisfied. When the two rules cannot be satisfied simultaneously, which occurs in a large set of economies, optimal monetary policy achieves only the second best. We analyze when the second-best monetary policy exceeds the Friedman rule and when it obeys the Friedman rule. Furthermore, we extend the analysis to an economy with barter and show how the Hosios rule must be modified in order to internalize all search externalities.