Having a great sense of humour is something very natural and actually having a great sense of humour is a gift which gets develops in some people naturally as I have seen there are people around who are really good at one-liners and cracking sarcastic jokes.
They haven’t done any sort of special courses to learn generate this ability in them they have built it up naturally.
Having a great sense of humour doesn’t mean you have to be stand-up comedian one can have this speciality in him. Well as you were you asking how can I master my sense of humour? So, the only suggestion I can give to you is to watch movies and TV series which are really good with their sarcastic kind of stuff.
I myself use to watch “Friends” it’s an American TV series and the mainstream reasons why I love watching this series is because of its characters and sarcastic stuff. It lightens up my mood and yeah it has also helped me building up humour in me so you should watch it too to enhance your sense of humour.