In this paper, we characterize optimal regulatory policies composed of a pollution standard, a probability of inspection and a fine for non-compliance, in a context where both monitoring and sanctioning are socially costly, and the penalty may include gravity and non-gravity components at the regulator's discretion. Under given penalties, the optimal policy entails compliance with the standard as long as a quite intuitive condition is met. Non-compliant policies may include standards even below the pollution levels that minimize the sum of abatement costs and external damages. Interestingly, the appropriate structure of the penalty under non-compliance is highly progressive, while the best possible shape of the fine under compliance is linear. If the regulator is entitled to choose the structure of the fine, linear penalties are socially preferred and the optimal policy induces compliance.