Western Sci-fi or science fiction westerns have been somewhat rare, and have not been totally accepted by true western fiction affectionados. There are some who have espoused ideas about aliens visiting the Old West. Whether or not aliens actually visited the west during the years of the gunfighters and the Indian wars is an intriguing question.
One fascinating movie of recent vintage was Cowboys & Aliens It had all the flavor of an Old West movie, plus the imaginative thrill of a good sci-fi movie.
Gene Autry, the classic western fiction movie star in the early days of “westerns” learned that. (Below is a movie starring Autry in an early attempt.)
Some have said that every sci-fi is, at heart, a western. The series Firefly
certainly carried that flavor. Another book that carries the flavor of a western, at least in terms of good guy bad guy aspects, is the book Millennium Soldier.