I'm so sorry. Losing a pet is very much the same as losing a family member. There's no two ways about it. What makes it more difficult is being able to have the emotional clarity to make the decision of letting a best friend go to end the suffering for them. Give your buddy the best couple days/weeks/months he can have. Make him feel comfortable, loved, and wanted. If you're upset, he'll become upset, but this time, it's your turn to provide him with that emotional support.
I think you'll know when it's time, and during the bereavement process, filling that emotional void may be the best thing you can do. We've never seen new pets as "replacements," but instead, emotional fortifiers which help to quickly strengthen a new bond.
When that time comes, adopt. Don't shop. Shelters are overcrowded, and the animals in them need to fill an emotional void just as much as you would, making for great relationships.