Your PR is protected, days outside Canada counted as days living in Canada if you are accompanying your Canadian citizen spouse.
However, there have been cases where people have been refused based on things like having been outside Canada for a long time before getting married to the Canadian spouse or having never lived in Canada and having a spouse live in Canada to gain citizenship and then join them overseas so it is obvious that they are not accompanying the spouse but the other way around. However, in most cases, these cases are won on appeal based on there being guidelines that state that immigration should not go into who is accompanying whom. There have however also been appeals that are lost.
In any case, even if you do lose your PR but are still married to a Canadian, your spouse would always be able to sponsor you again.