Connecting edges detected by an edge detector
This might not be complete solution, but will give you good direction.

Basically, what is the key criteria of to say that edges match? That "locally" the gradient of the edge matches and to some extent the distances are reasonable against how long the edge is continuous. 

If you have geometric edges, like long straight lines, Hough will do very seamless job right away. But this doesn't work when edges are arbitrary curve. In this case, you can still think of curve as roughly piece wise constant segments (good enough in your case), hence, you should take Hough locally. i.e. you can take a small portion of image (say a block) compute the Hough and identify some peaks. Based on this, you can identify that de-houghing is creating meaningful gap, if so, keep it or move on. 

Once smaller gaps are filled up, you can extend the same to take up on a larger size. the peaks will be more, but you may select fewer from it.