This paper develops a model of equilibrium unemployment with (unobservable) endogenous on-the-job search and (partly unobservable) endogenous search behavior by firms. The model allows to analyze crowding-out of unemployed job seekers by endogenous on-the job search of employees, and the interaction of job search behavior and vacancy posting policies of firms. Moreover, it is shown that the neglect of endogenous but not observable behavior in the empirical literature on labor matching leads to systematically biased estimates of the matching elasticities, posing a caveat on the results of previous studies testing for constant returns of the matching function. The theoretical model presented allows to predict the direction of the bias. We propose a correction for the estimates of empirical matching functions that leads to unbiased estimates of the matching elasticities. The empirical implications of the theoretical model are tested and confirmed using German administrative data, and unbiased estimates of matching elasticities are presented.