I am so sorry to read this.
Yes, you will be able to stay with him, and pet him as he slips away, which is very quick, a matter of seconds, and of course, he will be free of pain and suffering.
Rationally, you know you are doing the right thing. That you love him, and part of loving himis doing what needs to be done for him, even though it will hurt you terribly, you still have to do it, because he is hurting, and keeping him hurting to stop you hurting is wrong, and not loving him the way you know you do.
Emotionally, your mind is telling you to hang onto him, because you love him, and losing him will be almost more than you can bear.
But you will listen to your rational mind, and do what is right for him, and live with it.
And in time, when the raw pain has receeded, and you can think of all the fun and pleasure you had together, you will be glad that you did this one last act of kindness for him, to let him slip away from you with dignity, while you told him that you love him, and because he obviously knows you, he will know that what you have done is the right thing, and if he could talk, he woudl thank you.
That is for the future, when you weave his loss into your life, but for now, you must be strong for him, and stop his pain, because that is what loving him means - being able to let him go when the time has come.
Thinking of you.
A x