A device for forming foamed kneaded material comprising: a mold having a pattern forming space and a fill hole; a cylinder having an internal space capable of being supplied with foamed kneaded material, the internal space communicating with the pattern forming space by connecting the cylinder to the fill hole; a piston that presses foamed kneaded material supplied into the cylinder toward the pattern forming space side of the mold; an advancing-retreating movement mechanism that is provided at the piston, and that advances or retreats the piston in a direction to press the foamed kneaded material supplied into the cylinder or in the opposite direction thereto; and a gas release mechanism including a gas release hole that penetrates through the piston along a piston advancing-retreating movement direction, an open-close section that is capable of moving between a closed position that closes the gas release hole and an open position that opens the gas release hole, and an open-close drive mechanism that moves the open-close section between the closed position and the open position; the device being characterized by: a position detection section that detects a position of the piston in the cylinder; and a controller that controls the open-close drive mechanism such that the open-close section is disposed in the open position in cases in which it has been determined, based on a detection result of the position detection section, that the piston has not yet reached an expected position, which is a predetermined value where the piston is expected to be positioned on contacting the foamed kneaded material supplied into the cylinder, and that controls the open-close drive mechanism such that the open-close section is disposed in the closed position in cases in which it has been determined, based on a detection result of the position detection section, that the piston has reached the expected position. a mold having a pattern forming space and a fill hole; a cylinder having an internal space capable of being supplied with foamed kneaded material, the internal space communicating with the pattern forming space by connecting the cylinder to the fill hole; a piston that presses foamed kneaded material supplied into the cylinder toward the pattern forming space side of the mold; an advancing-retreating movement mechanism that is provided at the piston, and that advances or retreats the piston in a direction to press the foamed kneaded material supplied into the cylinder or in the opposite direction thereto; and a gas release mechanism including a gas release hole that penetrates through the piston along a piston advancing-retreating movement direction, an open-close section that is capable of moving between a closed position that closes the gas release hole and an open position that opens the gas release hole, and an open-close drive mechanism that moves the open-close section between the closed position and the open position; the device being characterized by: a position detection section that detects a position of the piston in the cylinder; and a controller that controls the open-close drive mechanism such that the open-close section is disposed in the open position in cases in which it has been determined, based on a detection result of the position detection section, that the piston has not yet reached an expected position, which is a predetermined value where the piston is expected to be positioned on contacting the foamed kneaded material supplied into the cylinder, and that controls the open-close drive mechanism such that the open-close section is disposed in the closed position in cases in which it has been determined, based on a detection result of the position detection section, that the piston has reached the expected position. a position detection section that detects a position of the piston in the cylinder; and a controller that controls the open-close drive mechanism such that the open-close section is disposed in the open position in cases in which it has been determined, based on a detection result of the position detection section, that the piston has not yet reached an expected position, which is a predetermined value where the piston is expected to be positioned on contacting the foamed kneaded material supplied into the cylinder, and that controls the open-close drive mechanism such that the open-close section is disposed in the closed position in cases in which it has been determined, based on a detection result of the position detection section, that the piston has reached the expected position.