Using tcolorbox
and defining two commands for regular and framed paragraphs which can be used as many times as required:

The code:
\documentclass{article}
\usepackage{titlesec}
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\newcommand\framedparagraph[1]{%
\tcbox[
enhanced,
colframe=cyan,
box align=base,
nobeforeafter,
top=1pt,
bottom=1pt,
left=2pt,
right=2pt,
enlarge left by=-1.2mm,
boxsep=0pt,
interior style={top color=orange!20,bottom color=magenta!20}
]{\theparagraph\hskip1em#1}%
}
\newcommand\FramedPara{%
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{}{0em}{\framedparagraph}
}
\newcommand\RegularPara{%
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
}
\setcounter{secnumdepth}{5}
\begin{document}
\section{some section}
\subsection{some subsection}
\subsubsection{some subsubsection}
\FramedPara
\paragraph{A test paragraph}
\lipsum[2]
\RegularPara
\paragraph{A test paragraph}
\lipsum[4]
\end{document}
Since paragraph titles are in a "runin" style, the height and depth for the box were kept to a minimum to not disrupt the regular separation between lines.