To improve the bonding strength of a resin layer for bonding a cover to a substrate, to prevent the resin layer from climbing up to an upper face from the side of the cover and from adhering to the upper face, and to use the upper face of the cover as a satisfactory reference face when an optical part such as a lens is incorporated.
The device is provided with the substrate 6 where a recess is formed on the upper face, a semiconductor element 7 placed on the base of the recess 6a, the resin layer 2 arranged on the whole periphery of the recess 6a at the upper face of the substrate 6, and the cover 5 which is bonded at the upper part of the resin layer 2 and which seals the semiconductor element 7. In the resin layer 2, wide parts 2a and narrow parts 2b are alternately formed. The layer 2 is bonded to an outer peripheral edge and a side at the lower face of the cover 5 in the wide part 6a.