Repair cracks in molded foam in sofa
If you are adventurous and have a lot of patience, remove the upholstery over the crack to get both sides exposed. That is the adventurous part. Next, widen ALL the cracks, even the little hairline cracks radiating from the larger ones, with a fine tooth narrow blade saw, something like a drywall saw, with finer teeth if possible. Get them all open to about 3/8" wide or so, a litle wider is ok, but not much more than 3/4". Wider=more difficult. Square out the areas where the small cracks stop, make sure you cut out all the crack. That is the patience part. Removal of the upholstery will keep everything clean, especially in the next step.

Using a can of the original, minimal expanding Touch and Foam for doors and windows, (no I do not work for them), NOT the latex based, but the urethane based, use the applicator straw to fill the cracks you just widened. The density of the foam should be compatible with the couch, and this stuff sticks to EVERYTHING, including you. The foam will expand beyond the face of the existing foam, use a piece of cardboard to flatten it down. This will smear it over the surrounding surfaces, creating a stronger bond and creating a skin that is denser than the "core" of foam in the center of the new application.

If the old foam will not line up with the remainder of the couch, you will need to support it in place to keep it in line with the rest while you do the repair. If it does not to cooperate, use a piece of 1/4" plywood on the inside, the upholstered side, bedded with the foam to reinforce it. Do not let the foam's expanding push it up to make a lump under your cushion. If it pushes out of the cracks you widened, trowel it flush with the cardboard.