A moving object detection device has a magnetic sensor element, a permanent magnet for applying a magnetic field to the magnetic sensor element; a board on which electronic parts are mounted, a holder; and a case. The holder has an integral approximately box-shaped support part to hold the magnet and the board, and the holder is inserted into the case so that the magnetic sensor element, the permanent magnet, and the board are contained in the case. The holder and the case are fitted and fastened to each other by concave-convex-shaped elements.