In this paper, we consider a wideband cognitive radio system that operates over multiple idle subchannels. A joint optimization of sensing threshold and transmission power is proposed, which maximizes the total throughput subject to the constraints on the total interference, the total power, and the probabilities of false alarm and detection of each subchannel. An alternative joint optimization is proposed, which minimizes the total interference under the constraint of the total throughput. The bilevel optimization method is used to solve the proposed optimization problems with a minimized iteration complexity. The mixed-variable optimization problem is divided into two single-variable convex optimization subproblems: the upper level for threshold optimization and the lower level for power optimization. Weighed cooperative sensing is proposed to maximize the detection probability by choosing the optimal weighed factors. The simulations show that the proposed joint optimization algorithm can achieve desirable improvement on the throughput of cognitive radio at the same interference level to primary user, or vice versa within the limits on the probabilities of false alarm and miss detection, and the weighed cooperative sensing can considerably improve sensing performance compared with the unweighed cooperative sensing and single-user sensing.