12 regenerations, 13 incarnations. But there are loopholes.
Many of the loopholes involve the Master. He attempted to get himself a new set of regenerations by using the Eye of Harmony, and apparently would have succeeded if the Doctor hadn't stopped him. He then took over Tremas's body, extended his life with the 'cheetah force', and transmuted himself into a 'deathworm' and took over a new body in the TV movie. Later, the Time Lords resurrected him, with a new cycle of regenerations, to fight in the Time War, and after he died for good again, he was brought back to life by human cultists. And there's even more in the novels and audios.
But the Doctor has used a few loopholes as well. He's had multiple deaths that were undone because history changed (e.g., Turn Left, The Big Bang). He used his severed hand to redirect the regeneration energy, healing him without regenerating. He was brought back to life by River using up all of her incarnations. And so on.
And other Time Lords have found different ones. For example, Rassilon became immortal in non-physical form, and was later restored to a physical body, and would have made all of the Time Lords immortal if he'd pulled off the final sanction. (In non-TV media, there are even more cases: the Other may have survived his death by throwing himself into the looms to later reincarnate as the Doctor; Iris Wildthyme claims she can live forever by just skipping her 13th incarnation the way a hotel elevator skips the 13th floor; etc.)
There's a great deal of both official information and fan speculation about this topic; the best way to get started is to follow links to some relevant articles: