NB - this could be a good question if you take note of the points below. If you don't the question will die.
This is the sort of answer that Google can be used to answer well.
People have been making this decision since about 1956 :-) - and had been looking forwards to making it since about 1905. However -
There are many many many issues. Which ones matter most and how important they are depend on your requirements, and you have not provided enough information to allow an excellent answer to be provided.
You should try and provide much much much more information or the men with the long knives will come an cast your question into outer darkness in no time flat.
What voltage?
What current?
What power level?
Are you switching AC or DC.
What is being controlled?
Resistive/inductive/capacitive load?
How often switched?
How fast does it need to switch?
How long is it on for, shortest time?
How long is it off for, shortest time?
How many switching actions in life time ?
Do you want isolation of output and input eg person and mains electricity.
What voltages do you have available for powering?
Why use a relay anmd not just a switch?
What is controlling this? (person, Arduino, cat, Water Buffalo ...?)
More information! More! More ! ... ;-)
BUT
RELAY:
A relay has a finite life. Maybe 1000, 10,000, 100,000 or 1,000,000 operations. More in a few cases.
Relays tend to take more power than a transistor circuit for the same job.
If you want very many operations or very long life times or very low operating power then relays may not be your best solution.
Relays provide low loss connections, don't need power on their output circuit, conduct AC currents easily are reasonably robust and blowup proof on the input side and OK on the output side if designed well.
TRANSISTOR:
Transistors can be operated with almost zero power if necessary, can switch very fast and can have extremely long lifetimes.
If switching AC special care is needed to provide bidirectional switching, - this is not hard but needs to be done. Decisions about when to switch compared to the AC voltage level can be made (but not with a relay).
Transistors tend to be less robust than relays in extreme conditions BUT can be designed to handle any eventuality that can be predicted.
Which is best for you depends very much on your answers to the questions at the top.