A semiconductor device comprising a plurality of well regions formed in a surface region of said substrate, the surface region of said substrate extending to a surface of the substrate, the regions extending to the surface of the substrate, the plurality of well regions having a memory provided therein, the memory including at least one MOSFET and a bipolar transistor in respective well regions of said plurality of well regions, each of the plurality of well regions having an impurity concentration profile, in a direction of increasing distance from the surface of the substrate, in a shape of two mountains with a valley between the two mountains, the valley providing a minimum point of impurity concentration in the impurity concentration profile, the minimum point of the impurity concentration profile being at least 0.5 .mu.m from the surface of the semiconductor substrate and having a concentration greater than 5.times.10.sup.14 cm.sup.-3, and a position of a maximum point of the profile being deeper than a position of said minimum point from the surface of the semiconductor substrate and within 1.6 .mu.m of the surface of the semiconductor substrate, whereby alpha-ray soft errors in the memory are decreased.