Yes, sweep makes a wing heavier and less efficient. But making the airfoil of a straight wing thinner runs into diminishing returns and also will drive up mass.
Since a thin wing needs to create the same lift as a thicker one, only the local speed increase from thickness can be tackled by making the airfoil thinner. The speed increase necessary for lift creation needs to be maintained, so the thickness contribution becomes a minor factor for the wings. However, a thinner wing requires a heavier spar to carry the same lift loads, so more lift needs to be created by the thinner wing to carry that extra weight. Now further thinning will drive up the speed increase from lift which will eat up the gains from thinning the wing.
If you look at parametric weight equations for airliner wings, the relative thickness at the wing root $\delta$ is part of them and generally occurs in a factor like
$$m_{Wing}\propto\frac{1}{\delta^{\,0.36}}$$
Now it is important to stress that this is valid for the range of thicknesses from which that relation had been derived, something between $\delta$ = 14% and 16%. If you drop below 14%, the exponent will most likely go up since the mass of the spar alone should be proportional to $\frac{1}{\delta}$ and becomes more dominant the thinner the wing becomes. But if root thickness is decreased from 15% to 14%, that means we stay within the limits of the statistical model, the wing mass increase should be 2.5%.
The same model gives the influence of sweep on wing mass as
$$m_{Wing}\propto\frac{1}{cos\varphi^{\,0.57}}$$
Based on 40° wing sweep, every decrease in spar thickness of 1% requires a sweep decrease of about 2.9° in order to keep wing weight constant, based on that relation. If that 1% thickness decrease allows you to desweep the wing by 3° or more, you come out ahead.
As always, a compromise is the best solution. Airliners of the propeller era had thicker wings than jet airliners. Some sweep and some thickness reduction will allow to push the critical Mach number to the highest value. Tank volume is indeed an important factor and is responsible for the comparatively low aspect ratios of early jet airliners.