How should moral sanctions and moral rewardsâ€”the moral sentiments involving feelings of guilt and of virtueâ€”be employed to govern individualsâ€™ behavior if the objective is to maximize social welfare? In the model that we examine, guilt is a disincentive to act and virtue is an incentive because we assume that they are negative and positive sources of utility. We also suppose that guilt and virtue are costly to inculcate and are subject to certain constraints on their use. We show that the moral sentiments should be used chiefly to control externalities and further that guilt is best to employ when most harmful acts can successfully be deterred whereas virtue is best when only a few individuals can be induced to behave well. We also contrast the optimal use of guilt and virtue to optimal Pigouvian taxation and discuss extensions of our analysis.