I've never been to Melilla, but I did spend a day in Ceuta. It is a peninsula jutting out of the North African coast with the Mediterranean Sea on both sides. Once you cross the Spanish border, you walk along a street for several kilometers before you reach the city proper, and all you pass are a few beach clubs and some open land facing the sea. Finding a place to pull up a boat and slip a few people ashore didn't look that difficult. The north end of the peninsula is a ruralish area around Monte Hacho, which is admittedly topped with a fort where they might keep some look-out, but which still looks a likely spot for illegal smuggling of either goods or people.
Even if you forget about Ceuta and Melilla, the Strait of Gibraltar is really narrow. I have another, presently unscanned, picture in which you can see Gibraltar itself from Monte Hacho. Gibraltar did seem a little harder to penetrate just because of the population density, but there's a lot of Spanish coast not too far away from northern Morocco.
In other words, while border control is important, in this case it's probably hopeless to think you can get a handle on the problem just by beefing up security. That brings us to the "Marshall Plan for Africa" line of thought, which isn't a bad idea of you can swing it.