You got it right! Bobby was Mike's imaginary friend through the whole movie, even at the beginning when on their way to California. His mother knew of Bobby and didn't discourage Mike leaning on Bobby since imaginary friends are common with young children.
That's why they both got stomach aches at the same time. That's why the boys' were so close.
At the end Mike was letting Bobby go. The "King" was arrested. Mike could go on without Bobby. It's also why Mike's mother didn't seem disturbed when Mike received the postcard (Mike had written & mailed) from Bobby the Ol' West tourist stop and the other postcards from all over the world. You noticed Mike's mother turned the first card over and looked at the postmark. What a great mom doing the best she could in the late sixties.
A 9 out of 10 for me. Brought back memories...