I normally ask sci-fi questions, but oh well...
It's fairly well established by this point that gills, while fine for fish, wouldn't work for mammals, as we need more oxygen than can reasonably be found in the water. This goes double for humans, since our brains use a lot of oxygen. Whales, however, don't use gills. Whales breathe on the surface, and stay underwater for anywhere between 20 to 90 minutes. And if you take a look at the tail of a traditional mermaid, you'll notice that it actually resembles the tail of a whale more than it does a fish (the exception is shown in the fourth Harry Potter movie. Those merfolk had fish-like bodies, which made them a lot creepier). If we go with the traditional depiction of a mermaid/merman having a human upper body and a whale-like lower body, it strikes me as being more realistic that merfolk would be air-breathers that need to come up periodically for oxygen.
We don't have to explain how merfolk could have possibly evolved. Let's assume that they were created via magic, or genetic engineering. Let's also assume that that upper body only has to LOOK human, internal organs can be rearranged. For instance, the upper body could be filled by a massive set of lungs twice the size of a human's, while the digestive tract has been mostly moved down into the whale body.
With this in mind, is it physically viable to have air-breathing merfolk who can routinely stay underwater (actively moving around, not just sitting to conserve oxygen like human record-breakers do) for at least 30 minutes, or are there too many biological problems with the whole concept?