Examine the tear. If it is shallow, spray the glue close to the surface, pinch the edges of the tear together and hold them for two minutes to set the bond or according to the instructions on the glue you use. If the tear is deep, pull apart both sides of the rip and spray into the tear, coating both sides, pointing the nozzle close to the surfaces of the tear. Let the surfaces come back together. You can also use small pieces of tape to assure that the sides of the foam bond together after you have sprayed both sides.
Let the glue dry for eight hours before putting the bedding or furniture coverings back on, or consult the instructions on the can of glue for the amount of time the manufacturer recommends.
Test the integrity of the bond by gently pushing down on the surface of the mattress at the edges of the tear with your fingers. If the tear shows signs of separating, repeat the gluing process.