An ultrasonic sealing apparatus for use in a bag filling and packaging machine in which a bag is held by being gripped at its laterally opposite side edges with a pair of laterally spaced grippers and the bag held in this way is moved along a predetermined path to sequentially undergo predetermined packaging processes, the ultrasonic sealing apparatus comprising: an ultrasonic sealing apparatus body having a horn and an anvil which are movable toward and away from each other, the ultrasonic sealing apparatus body being disposed at a predetermined sealing step position in the bag filling and packaging machine; a sensor disposed at the sealing step position to detect whether or not a mouth (b) of a bag moved to the sealing step position is in a predetermined sealing enable position between the horn and the anvil; a control unit controlling the ultrasonic sealing apparatus body on a basis of a signal from the sensor, characterized in that a threshold value is determined to be a thickness with which a portion of the bag mouth (b) held between the horn and the anvil can function as a buffer against ultrasonic vibration, and the sensor is configured to detect a distance between respective pressing surfaces (40,50) of the horn and the anvil that press the bag B when the horn and the anvil are pressed against each other with the mouth (b) of the bag held therebetween, and the control unit is configured to judge that the mouth (b) of the bag is in the sealing enable position when the distance detected by the sensor is not less than the threshold value, and configured to control the ultrasonic sealing apparatus body to apply ultrasonic vibration to the horn, whereas, when the distance detected by the sensor is less than the threshold value, the control unit is configured to judge that the mouth (b) of the bag is not in the sealing enable position, and configured to control the ultrasonic sealing apparatus body not to apply ultrasonic vibration to the horn. an ultrasonic sealing apparatus body having a horn and an anvil which are movable toward and away from each other, the ultrasonic sealing apparatus body being disposed at a predetermined sealing step position in the bag filling and packaging machine; a sensor disposed at the sealing step position to detect whether or not a mouth (b) of a bag moved to the sealing step position is in a predetermined sealing enable position between the horn and the anvil; a control unit controlling the ultrasonic sealing apparatus body on a basis of a signal from the sensor, characterized in that a threshold value is determined to be a thickness with which a portion of the bag mouth (b) held between the horn and the anvil can function as a buffer against ultrasonic vibration, and the sensor is configured to detect a distance between respective pressing surfaces (40,50) of the horn and the anvil that press the bag B when the horn and the anvil are pressed against each other with the mouth (b) of the bag held therebetween, and the control unit is configured to judge that the mouth (b) of the bag is in the sealing enable position when the distance detected by the sensor is not less than the threshold value, and configured to control the ultrasonic sealing apparatus body to apply ultrasonic vibration to the horn, whereas, when the distance detected by the sensor is less than the threshold value, the control unit is configured to judge that the mouth (b) of the bag is not in the sealing enable position, and configured to control the ultrasonic sealing apparatus body not to apply ultrasonic vibration to the horn.