This paper analyses simultaneous regulation of cost and quality when firms have private, correlated information about productivity and the regulator receives a signal about quality. It is shown that managerial effort and expenditures on quality are positively correlated in the optimal contract. The higher is firm productivity the more should the firm spend on quality improvement and the more efficiently should it produce. Optimal yardstick competition reduces distortion of both effort and quality. Under product market competition expenditures on quality should be increasing in the firm's own productivity and decreasing in the competitor's productivity.