It is mentioned in Sahih Al-Bukhari, “Aisha r.a. says that the Prophet used to kiss and embrace his wives while fasting but he was best amongst you to control himself.”
That means the prophet had the power to control. Similarly it is mentioned in Abu-Dawud, “Umar r.a. while fasting kissed his wife and immediately he feels sorry and he goes to the prophet and he says that ‘O Prophet i have sinned against you and Allah’ so Prophet says ’What have you done?’ he says ‘while fasting I kissed my wife’ so the prophet asked him that when you gargle or rinse your mouth while doing wudhu does your fast break?’
so Umar r.a. said “no!” so Prophet said Why bother?”. Another hadith in musnand ahmad says, “A young man comes to Prophet (peace be upon him) and asks him can I kiss my wife while I am fasting? The prophet says ‘No!’ later on an old man comes to the prophet and asks him can I kiss my wife while fasting? and the prophet says ‘Yes!’ So the sahabas look among themselves that how come the answer is differing then the Prophet replies ‘this man can control himself’.”
So the basic ruling is if a person knows that he can control himself after kissing or hugging his wife and he is sure it won’t lead to an act which will nullify his fast,
for example it will not lead to a sexual intercourse or will not lead to ejaculation as long as he can control himself, kissing and hugging is permissible. If he cannot control then it is prohibited for him.
(Source - Dr Zakir Naik Lecture)