Optimal control problems involving hybrid binary-continuous control costs are challenging due to their lack of convexity and weak lower semicontinuity. Replacing such costs with their convex relaxation leads to a primal-dual optimality system that allows an explicit pointwise characterization and whose MoreauYosida regularization is amenable to a semismooth Newton method in function space. This approach is especially suited for computing switching controls for partial differential equations. In this case, the optimality gap between the original functional and its relaxation can be estimated and shown to be zero for controls with switching structure. Numerical examples illustrate the effectiveness of this approach.