'03 Nissan Sentra tranny shifting for no reason

Two years ago (September) my 03 Nissan Sentra began occasionally downshifting into a lower gear while driving on the highway and wouldn’t want to shift out of first gear after a stop unless I shut engine off and restarted. Around same time, my cruise control began sometimes shutting off by itself. When the Check Engine light eventually came on, took it to dealer. They said “need to replace both the Trans. speed sensor and the speedo head to fix this, although not a necessary repair”.
I replaced the speed sensor, but have not done the speedo head, as it is expensive. Since the problems first began, they happened more and more frequently going into winter, but then almost completely went away when weather began warming up. Check engine light didn’t come on again until the following fall. As I live in the desert, our winter is not all that cold, so I figured “coincidence”…Until the problems came back in the same way, and then disappeared again when the weather warmed up. None of my mechanically inclined friends thinks the speedo head could have anything to do with this…Any ideas?