Does a long period in an MSc program look bad on a CV? I'm an MSc student in (pure) math. Based on CV's I've seen of professors and post-docs in the field, it seems that almost all of them graduated in about 2 years. Where I study (let's say, medium-level university) it's common that most good students graduate in 2.5-3 years (with 2 years being the "standard" period of time by the definition of our graduate program). 

I expect to graduate a year from now, 3.5 years from the start of my studies. If I decide to apply to a US university for a PhD, I might need to wait another year till the beginning of the PhD program, since I won't make it to the closest deadline.

Would something like this look bad on my CV when applying to a PhD program, or to any further academic position? What would be the best way to deal with the one-year gap in the latter case? Would it be better to extend my MSc studies to 4.5 years to avoid a gap? (In any case I'm planning to continue doing research during that time.)

This question might be considered related: My PhD went over time - advice for explaining this on a CV
However I find it different in that the OP is asking about a PhD degree, which is a different stage in one's career, they are planning to look for a job in industry as opposed to academia, and the question deals with some ethics involved.
The gap year isn't a big deal, but taking so much longer than normal to graduate does look bad.  You should try to address it in your statement of purpose.

Of course, after you get a PhD nobody will notice or care how long it took to get your MSc.