He and Megatron (or his numerous iterations) have always shared a mutual respect for each other, and have opposed each other in nearly every depiction of the Transformers universe.
In the 1986 Transformers animated film, Optimus Prime was killed after a fierce battle with Megatron, but his character returned several times during the series.
Optimus Prime was the most liked character among young viewers of the original series, although his toy was not the highest selling (original release, excludes all others).
Megatron: “Why throw away your life so recklessly?”
Optimus Prime: That’s a question you should ask yourself, Megatron..”