Have pilots encountered a UFO, and what to do if you have?
Pilots do encounter UFOs all the time. I just want to emphasize that UFO means "Unidentified Flying Object" - something which is flying, and which the pilot cannot identify. It does not mean an alien craft.

The guidelines for pilots are as follows (AIM 7-6-4):


  7-6-4. Unidentified Flying Object (UFO) Reports
  
  a. Persons wanting to report UFO/unexplained phenomena activity should contact a UFO/unexplained phenomena reporting data collection center, such as Bigelow Aerospace Advanced Space Studies (BAASS) (voice: 1-877-979-7444 or e-mail: Reporting@baass.org), the National UFO Reporting Center, etc.
  
  b. If concern is expressed that life or property might be endangered, report the activity to the local law enforcement department.


Air traffic controllers have the following guidance under FAA Order 7110.65 section 9-8-1:


  9-8-1. GENERAL
  
  a. Persons wanting to report UFO/unexplained phenomena activity should contact a UFO/ unexplained phenomena reporting data collection center, such  the National UFO Reporting Center, etc.
  
  b. If concern is expressed that life or property might be endangered, report the activity to the local law enforcement department.


The question "Was it of the E.T. kind" is beyond the scope of this site. This subject is, let's just say, suitably covered by other sites on the Internet at large.

One notable example of a UFO report is the 2006 O'Hare UFO sighting. For other examples, a Google search for "pilot UFO anecdotes" offers some decent results. "ATC UFO report" even links to some recordings of pilot UFO reports to ATC.

Some objects commonly reported (genuinely) as UFOs are spacecraft, fast or high-flying military aircraft like the U-2 or the SR-71 when it was in service, rocket launches, weather balloons, kites, errant helium balloons from kids' birthday parties, flocks of birds, con trails, and lightning storms. Any of these and more can easily look, under the right circumstances, to a pilot like a "UFO."

The closest experience I've had in my flying history to a "UFO" happened at night, during a landing approach in the midwest U.S. I was on a downwind leg when a very bright light appeared above me in the center of the windscreen, and rapidly moved downward toward the horizon. It scared me half to death; my instinctual thought was that it was the landing light of another plane descending on top of me. It turned out to be a meteorite. It only took me a second or two to figure it out, but boy did it get my adrenaline up! There was no need to report it though.

Culturally, pilots are generally apprehensive about reporting UFOs, out of fear of sounding like a lunatic or unhinged conspiracy theorist and being laughed at. Nonetheless, reports are not uncommon.