I have both: a gen3 Glock 17 and an M&P 9 Pro Series. Both are excellent guns. I shoot the M&P quite a bit more often than the G17 and find it to be very accurate and reliable. It is more sensitive to dirt than is the G17, particularly dirty magazines. The standard Glock sights, in a word, suck. I replace mine with after market sights and I especially like Trijicon night sights, model GL01. The triggers on both of these guns can be improved upon and I have done just that with mine. My G17 has a 6 pound trigger spring (makes the trigger lighter), a 3.5 Glock connector (part #00135), and a thorough polishing of all contact parts in the trigger/connector/striker lug/safety block assemblies (the 25 cent trigger job). My M&P has the Apex Tactical USB (Ultimate Safety Block) which completely removes the gritty pre-travel and lightens the trigger a little.
As for taking a decision between these two, that is a hard one. Glock may have the edge in reliability and it is a simpler gun. Parts are widely available, inexpensive, and simple to install yourself. And the Glock is easier to clean than the M&P. The Glock has a better loaded chamber indicator; the LCI on the M&P is a joke. The M&P has one of the best feels to its grip out there and is a fine natural pointer and it is a more attractive gun, if that's important.
Here's a good answer... get both. No, I mean it. I did and am happy I did.