The 27-year-old moved to the Bluebirds from Barnsley last summer and made 45 appearances for Dave Jones' side.
"It came out of the blue at the end of last season - the manager spoke to me and asked if I was prepared to stay with the club for a longer period - and I was delighted to accept the offer," said McPhail.
"The negotiations went on over the summer, the manager and chairman wanted to make sure that I liked it here, and I'm really pleased that it was all concluded."