We know anode=oxidation=loss of electrons and cathode=reduction=gain of electrons but in the photoelectric effect the electrons are gained at the anode and lost at the cathode of the discharge tube? References: Anode, Cathode, Oxidation, Reduction
entropid's answer is correct, but I'll try to express it differently. As Bard et al. state in Electrochemical Dictionary (1), the concept of anode and cathode is related only to the direction of electron flow: The anode is the electrode at which oxidation occurs (in an electrochemical cell) and electrons flow from electrolyte to electrode and the cathode is where reduction occurs and electrons flow from electrode to electrolyte. In a galvanic cell with a zinc anode, the electrons are flowing away from the interface in the electrode. Similarly, in a phototube, electrons emitted by the cathode are collected by the anode and again, electrons are moving away from the interface in the anode.
Where the electrons are actually coming from isn't important, just what direction they flow with respect to the electrode interface. Electrons moving from interface towards electrode = anode, electrons moving from electrode towards interface = cathode.
(1) Electrochemical Dictionary; Bard, A. J.; Inzelt, G.; Scholz, F., Eds.; Springer Berlin Heidelberg: Berlin, Heidelberg, 2008, pp 31.
The definition of anode, according to Wikipedia, is:
An anode is an electrode through which positive electric charge flows into a polarized electrical device. The flow of charge is an electric current.
The confusion here arises from the fact that you should not look at the chamber where the photoelectric effect occurs but at the circuit instead. This way, you will notice that the anode is the one which is losing electrons (accumulated by the photoelectric effect onto it). These electrons flow through the circuit to the cathode, which is gaining electrons.
I addressed this here: Cathode + Anode + Rechargeable Battery
There is a prevalent terminology inconsistency, where the positive terminal of a rechargeable battery is incorrectly labeled as the cathode. This is half correct, because it is correct during discharge where the positive terminal performs the reduction half reaction and receives electrons, but it is the anode during charge where it performs the oxidation half reaction and produces electrons.
A minority label the two physical terminals positive/negative instead of cathode/anode which is more correct and logical, but the more confusing notation is prevalent.