Both commas are needed. But your second is not a relative clause. It could be a reduced relative clause.
Student or Learner
1- Shakespeare was a great writer(,) who wrote 38 plays and 154 sonnets.
2- Shakespeare was a great writer(,) writing 38 plays and 154 sonnets.
I'd like to ask if I should put a comma in each sentence after the word 'writer' or not. I think we should because they are non-defining relative clauses.